From 7b1f90e3b8b49c9a141b0c115a7437db434fbbd3 Mon Sep 17 00:00:00 2001
From: Jacob Noah <jacob.noah.jnn@gmail.com>
Date: Tue, 7 Nov 2023 12:39:35 +0100
Subject: [PATCH 1/4] keep both conflict fix

---
 .../web-app-files/src/helpers/resource/actions/upload.ts | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/packages/web-app-files/src/helpers/resource/actions/upload.ts b/packages/web-app-files/src/helpers/resource/actions/upload.ts
index ca5ba682a89..161548f1d12 100644
--- a/packages/web-app-files/src/helpers/resource/actions/upload.ts
+++ b/packages/web-app-files/src/helpers/resource/actions/upload.ts
@@ -73,10 +73,13 @@ export class ResourceConflict extends ConflictDialog {
     let allConflictsStrategy
     let doForAllConflictsFolders = false
     let allConflictsStrategyFolders
+    console.log('upload.ts executed')
 
     for (const conflict of conflicts) {
+      console.log(conflict, 'conflict')
       const isFolder = conflict.type === 'folder'
       const conflictArray = isFolder ? resolvedFolderConflicts : resolvedFileConflicts
+      console.log(conflict, 'conflictArr')
 
       if (doForAllConflicts && !isFolder) {
         conflictArray.push({
@@ -165,18 +168,18 @@ export class ResourceConflict extends ConflictDialog {
           `/${newFolderName}/`
         )
         file.meta.tusEndpoint = file.meta.tusEndpoint.replace(
-          new RegExp(`/${encodeURIComponent(folder)}`),
+          new RegExp(`/${encodeURIComponent(folder)}$`),
           `/${encodeURIComponent(newFolderName)}`
         )
         if (file.xhrUpload?.endpoint) {
           file.xhrUpload.endpoint = file.xhrUpload.endpoint.replace(
-            new RegExp(`/${encodeURIComponent(folder)}`),
+            new RegExp(`/${encodeURIComponent(folder)}$`),
             `/${encodeURIComponent(newFolderName)}`
           )
         }
         if (file.tus?.endpoint) {
           file.tus.endpoint = file.tus.endpoint.replace(
-            new RegExp(`/${encodeURIComponent(folder)}`),
+            new RegExp(`/${encodeURIComponent(folder)}$`),
             `/${encodeURIComponent(newFolderName)}`
           )
         }

From 8d5b7e8b395a63718aadaa67320a3d97494105ce Mon Sep 17 00:00:00 2001
From: Jacob Noah <jacob.noah.jnn@gmail.com>
Date: Tue, 7 Nov 2023 12:44:06 +0100
Subject: [PATCH 2/4] keep both conflict cleanup

---
 packages/web-app-files/src/helpers/resource/actions/upload.ts | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/packages/web-app-files/src/helpers/resource/actions/upload.ts b/packages/web-app-files/src/helpers/resource/actions/upload.ts
index 161548f1d12..39274f62ea9 100644
--- a/packages/web-app-files/src/helpers/resource/actions/upload.ts
+++ b/packages/web-app-files/src/helpers/resource/actions/upload.ts
@@ -73,13 +73,10 @@ export class ResourceConflict extends ConflictDialog {
     let allConflictsStrategy
     let doForAllConflictsFolders = false
     let allConflictsStrategyFolders
-    console.log('upload.ts executed')
 
     for (const conflict of conflicts) {
-      console.log(conflict, 'conflict')
       const isFolder = conflict.type === 'folder'
       const conflictArray = isFolder ? resolvedFolderConflicts : resolvedFileConflicts
-      console.log(conflict, 'conflictArr')
 
       if (doForAllConflicts && !isFolder) {
         conflictArray.push({

From 9a8551c04ec1c16d0808c5c694006e203f7b28ff Mon Sep 17 00:00:00 2001
From: Jacob Noah <jacob.noah.jnn@gmail.com>
Date: Thu, 9 Nov 2023 12:39:45 +0100
Subject: [PATCH 3/4] added changelog, keep both conflict

---
 changelog/unreleased/bugfix-keep-both-conflict | 6 ++++++
 1 file changed, 6 insertions(+)
 create mode 100644 changelog/unreleased/bugfix-keep-both-conflict

diff --git a/changelog/unreleased/bugfix-keep-both-conflict b/changelog/unreleased/bugfix-keep-both-conflict
new file mode 100644
index 00000000000..9e0525aee22
--- /dev/null
+++ b/changelog/unreleased/bugfix-keep-both-conflict
@@ -0,0 +1,6 @@
+Bugfix: Keep both folders and their files when parent and child folder has same name
+
+Parsing has been adjusted to account for edge case of multiple folders and sub-folders with the same name
+
+https://github.com/owncloud/web/pull/9915
+https://github.com/owncloud/web/issues/9158

From 9b6c8ddf7b14e25f98e8aafd50445c6ad00e0833 Mon Sep 17 00:00:00 2001
From: Jacob Noah <jacob.noah.jnn@gmail.com>
Date: Thu, 9 Nov 2023 13:22:55 +0100
Subject: [PATCH 4/4] fixed changelog, keep both conflict

---
 changelog/unreleased/bugfix-keep-both-conflict | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/changelog/unreleased/bugfix-keep-both-conflict b/changelog/unreleased/bugfix-keep-both-conflict
index 9e0525aee22..471cc16accf 100644
--- a/changelog/unreleased/bugfix-keep-both-conflict
+++ b/changelog/unreleased/bugfix-keep-both-conflict
@@ -1,4 +1,4 @@
-Bugfix: Keep both folders and their files when parent and child folder has same name
+Bugfix: Keep both folders conflict in same-named folders
 
 Parsing has been adjusted to account for edge case of multiple folders and sub-folders with the same name