eventmanager: don't modify in place fs events paths

Signed-off-by: Nicola Murino <nicola.murino@gmail.com>
This commit is contained in:
Nicola Murino 2023-01-01 16:31:36 +01:00
parent 64c28bf6aa
commit 5605496c5f
No known key found for this signature in database
GPG key ID: 935D2952DEC4EECF
3 changed files with 7 additions and 6 deletions

View file

@ -1239,10 +1239,11 @@ func getUserForEventAction(user dataprovider.User) (dataprovider.User, error) {
}
func replacePathsPlaceholders(paths []string, replacer *strings.Replacer) []string {
for idx := range paths {
paths[idx] = util.CleanPath(replaceWithReplacer(paths[idx], replacer))
results := make([]string, 0, len(paths))
for _, p := range paths {
results = append(results, util.CleanPath(replaceWithReplacer(p, replacer)))
}
return util.RemoveDuplicates(paths, false)
return util.RemoveDuplicates(results, false)
}
func executeDeleteFileFsAction(conn *BaseConnection, item string, info os.FileInfo) error {

View file

@ -229,7 +229,7 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
<script src="{{.StaticURL}}/vendor/bootstrap-select/js/bootstrap-select.min.js"></script>
<script type="text/javascript">
$("body").on("click", ".add_new_group_field_btn", function () {
var index = $(".form_field_groups_outer").find("form_field_groups_outer_row").length;
var index = $(".form_field_groups_outer").find(".form_field_groups_outer_row").length;
while (document.getElementById("idGroup"+index) != null){
index++;
}

View file

@ -543,7 +543,7 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
});
$("body").on("click", ".add_new_fs_path_pattern_field_btn", function () {
var index = $(".form_field_fs_paths_outer").find("form_field_fs_paths_outer_row").length;
var index = $(".form_field_fs_paths_outer").find(".form_field_fs_paths_outer_row").length;
while (document.getElementById("idFsPathPattern"+index) != null){
index++;
}
@ -573,7 +573,7 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
});
$("body").on("click", ".add_new_action_field_btn", function () {
var index = $(".form_field_action_outer").find("form_field_action_outer_row").length;
var index = $(".form_field_action_outer").find(".form_field_action_outer_row").length;
while (document.getElementById("idActionName"+index) != null){
index++;
}