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
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 { func replacePathsPlaceholders(paths []string, replacer *strings.Replacer) []string {
for idx := range paths { results := make([]string, 0, len(paths))
paths[idx] = util.CleanPath(replaceWithReplacer(paths[idx], replacer)) 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 { 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 src="{{.StaticURL}}/vendor/bootstrap-select/js/bootstrap-select.min.js"></script>
<script type="text/javascript"> <script type="text/javascript">
$("body").on("click", ".add_new_group_field_btn", function () { $("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){ while (document.getElementById("idGroup"+index) != null){
index++; 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 () { $("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){ while (document.getElementById("idFsPathPattern"+index) != null){
index++; 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 () { $("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){ while (document.getElementById("idActionName"+index) != null){
index++; index++;
} }