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): load tasks only when a user is logged in to prevent interceptor redirects when refreshing a public link URL
johavenbda58d609465
diff --git a/frontend/src/app/applications/files/services/files-tasks.service.ts b/frontend/src/app/applications/files/services/files-tasks.service.tsindex c703e7f2..fe783ff6 100644--- a/frontend/src/app/applications/files/services/files-tasks.service.ts+++ b/frontend/src/app/applications/files/services/files-tasks.service.ts@@ -18,6 +18,7 @@ import { escapeRegexp } from '../../../common/utils/regexp'import { TAB_MENU } from '../../../layout/layout.interfaces'import { LayoutService } from '../../../layout/layout.service'import { StoreService } from '../../../store/store.service'+import { UserType } from '../../users/interfaces/user.interface'import { FileEvent } from '../interfaces/file-event.interface'@Injectable({ providedIn: 'root' })@@ -57,11 +58,18 @@ export class FilesTasksService {msg: { success: 'Decompression done', failed: 'Decompression failed' }}}+ private currentUserId: numberprivate watcher: Subscription = nullprivate watch = timer(1000, 1000).pipe(tap(() => this.doWatch()))constructor() {- this.loadAll()+ this.store.user.subscribe((u: UserType) => {+ if (u && this.currentUserId !== u?.id) {+ // Load tasks when the user is defined and has changed to prevent interceptor redirects+ this.loadAll()+ }+ this.currentUserId = u?.id+ })}addTask(task: FileTask) {diff --git a/frontend/src/app/applications/files/services/files.service.ts b/frontend/src/app/applications/files/services/files.service.tsindex 2c0502a8..d5f5e222 100644--- a/frontend/src/app/applications/files/services/files.service.ts+++ b/frontend/src/app/applications/files/services/files.service.ts@@ -292,7 +292,7 @@ export class FilesService {})}- async openViewerDialog(file: FileModel, directoryFiles: FileModel[], permissions: string) {+ async openViewerDialog(file: FileModel, directoryFiles: FileModel[], permissions: string): Promise<void> {this.http.head(file.dataUrl).subscribe({next: async () => {// This check is only used for the text viewer; other viewers are read-only or enforce permissions on the backend.