2021-12-14 17:34:52 +00:00
|
|
|
/*
|
2022-04-25 09:01:09 +00:00
|
|
|
Package clean provides validation, sanitation, and normalization of input values.
|
2021-12-14 17:34:52 +00:00
|
|
|
|
2023-01-11 15:43:01 +00:00
|
|
|
Copyright (c) 2018 - 2023 PhotoPrism UG. All rights reserved.
|
2021-12-14 17:34:52 +00:00
|
|
|
|
2022-08-10 14:09:21 +00:00
|
|
|
This program is free software: you can redistribute it and/or modify
|
|
|
|
it under Version 3 of the GNU Affero General Public License (the "AGPL"):
|
|
|
|
<https://docs.photoprism.app/license/agpl>
|
2021-12-14 17:34:52 +00:00
|
|
|
|
2022-08-10 14:09:21 +00:00
|
|
|
This program is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
GNU Affero General Public License for more details.
|
2021-12-14 17:34:52 +00:00
|
|
|
|
2022-08-10 14:09:21 +00:00
|
|
|
The AGPL is supplemented by our Trademark and Brand Guidelines,
|
|
|
|
which describe how our Brand Assets may be used:
|
2023-02-08 08:07:42 +00:00
|
|
|
<https://www.photoprism.app/trademark>
|
2021-12-14 17:34:52 +00:00
|
|
|
|
2022-04-13 20:17:59 +00:00
|
|
|
Feel free to send an email to hello@photoprism.app if you have questions,
|
2021-12-14 17:34:52 +00:00
|
|
|
want to support our work, or just want to say hello.
|
|
|
|
|
|
|
|
Additional information can be found in our Developer Guide:
|
2022-02-27 16:32:54 +00:00
|
|
|
<https://docs.photoprism.app/developer-guide/>
|
2021-12-14 17:34:52 +00:00
|
|
|
*/
|
2022-04-15 07:42:07 +00:00
|
|
|
package clean
|
2021-12-16 14:26:54 +00:00
|
|
|
|
|
|
|
import "strings"
|
|
|
|
|
|
|
|
const MaxLength = 4096
|
|
|
|
|
|
|
|
func reject(s string, maxLength int) bool {
|
|
|
|
if maxLength > 0 && len(s) > maxLength {
|
|
|
|
return true
|
|
|
|
}
|
|
|
|
|
|
|
|
if strings.Contains(s, "${") || strings.Contains(s, "ldap://") {
|
|
|
|
return true
|
|
|
|
}
|
|
|
|
|
|
|
|
return false
|
|
|
|
}
|