Sync-in · Sovereign platform for file storage, sharing, synchronization, and collaboration.
TypeScript cloud-alternativecollaborationcollaborative-editingdropboxfile-serverfile-sharingfile-storagefile-syncfull-text-searchhomelabnextcloudon-premiseopen-sourceprivacy-firstprivate-cloudrealtimesecureself-hostedstorage-serverwebdav
fix(frontend:files): normalize file names in FormData to prevent unicode normalization mismatches
johavena0db60c691b7
diff --git a/frontend/src/app/applications/files/services/files-upload.service.ts b/frontend/src/app/applications/files/services/files-upload.service.tsindex 01758ef6..69695265 100644--- a/frontend/src/app/applications/files/services/files-upload.service.ts+++ b/frontend/src/app/applications/files/services/files-upload.service.ts@@ -27,8 +27,8 @@ export class FilesUploadService {const taskReqs: [FileTask, Observable<any>][] = []for (const [key, data] of Object.entries(this.sortFiles(files))) {- const path = `${this.filesService.currentRoute}/${key}`.split('/').slice(0, -1).join('/').normalize()- const name = `${this.filesService.currentRoute}/${key}`.split('/').slice(-1)[0].normalize()+ const path = `${this.filesService.currentRoute}/${key}`.split('/').slice(0, -1).join('/')+ const name = `${this.filesService.currentRoute}/${key}`.split('/').slice(-1)[0]const task: FileTask = this.filesTasksService.createUploadTask(path, name, data.size)taskReqs.unshift([task,@@ -78,9 +78,9 @@ export class FilesUploadService {const sort: Record<string, { nb: number; size: number; form: FormData }> = {}for (const f of files) {const relPath = f.relativePath || f.webkitRelativePath- const key = relPath ? relPath.split('/')[0] : f.name+ const key = (relPath ? relPath.split('/')[0] : f.name).normalize()if (!(key in sort)) sort[key] = { nb: 0, size: 0, form: new FormData() }- sort[key].form.append('file', f, relPath || f.name)+ sort[key].form.append('file', f, (relPath || f.name).normalize())sort[key].nb++sort[key].size += f.size}diff --git a/frontend/src/app/applications/spaces/components/spaces-browser.component.ts b/frontend/src/app/applications/spaces/components/spaces-browser.component.tsindex 50c7a790..e3d805a9 100644--- a/frontend/src/app/applications/spaces/components/spaces-browser.component.ts+++ b/frontend/src/app/applications/spaces/components/spaces-browser.component.ts@@ -700,26 +700,26 @@ export class SpacesBrowserComponent implements OnInit, AfterViewInit, OnDestroythis.filesService.openViewerDialog(mode, this.selection[0]).catch(console.error)}- private focusOn(select: string) {- if (select) {- if (this.files.length) {- let f = this.files.find((file) => file.name.toLowerCase() === select.toLowerCase())- if (!f && this.hasRoots) {- f = this.files.find((file) => file.root?.alias.toLowerCase() === select.toLowerCase())- }- if (f) {- setTimeout(() => this.scrollView.scrollInto(f), 100)- this.updateSelection([f])- } else {- // wait for the `loadFiles`- this.focusOnSelect = select- }- } else {- // wait for the `loadFiles`- this.focusOnSelect = select- }- } else {+ private focusOn(selectName: string) {+ if (!selectName) {this.focusOnSelect = null+ return+ }+ if (!this.files.length) {+ // wait for the `loadFiles`+ this.focusOnSelect = selectName+ return+ }+ let f = this.files.find((file) => file.name.toLowerCase() === selectName.toLowerCase())+ if (!f && this.hasRoots) {+ f = this.files.find((file) => file.root?.alias.toLowerCase() === selectName.toLowerCase())+ }+ if (f) {+ setTimeout(() => this.scrollView.scrollInto(f), 100)+ this.updateSelection([f])+ } else {+ // wait for the `loadFiles`+ this.focusOnSelect = selectName}}