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
feat(files): support saving VSDX and Gliffy imports as draw.io
johaven0b44510166a5
diff --git a/backend/src/applications/files/editors/drawio/drawio-manager.service.spec.ts b/backend/src/applications/files/editors/drawio/drawio-manager.service.spec.tsindex 8a32c2f2..e123849f 100644--- a/backend/src/applications/files/editors/drawio/drawio-manager.service.spec.ts+++ b/backend/src/applications/files/editors/drawio/drawio-manager.service.spec.ts@@ -58,6 +58,14 @@ describe(DrawioManager.name, () => {})})+ it.each(['vsdx', 'gliffy'])('supports importing .%s files', async (extension) => {+ const importedSpace = { ...mockSpace, realPath: `/path/to/diagram.${extension}` } as SpaceEnv++ await expect(service.getSettings(importedSpace)).resolves.toEqual({+ documentServerUrl: 'https://sync-in.test/drawio/'+ })+ })+it('returns the configured external draw.io URL', async () => {const drawioConfig = configuration.applications.files.editors.drawioconst localExternalServer = drawioConfig.externalServerdiff --git a/backend/src/applications/files/editors/drawio/drawio-manager.service.ts b/backend/src/applications/files/editors/drawio/drawio-manager.service.tsindex 37a8a119..e85392f3 100644--- a/backend/src/applications/files/editors/drawio/drawio-manager.service.ts+++ b/backend/src/applications/files/editors/drawio/drawio-manager.service.ts@@ -4,7 +4,7 @@ import { configuration } from '../../../../configuration/config.environment'import { ContextManager } from '../../../../infrastructure/context/services/context-manager.service'import type { SpaceEnv } from '../../../spaces/models/space-env.model'import { isPathExists, isPathIsDir } from '../../utils/files'-import { DRAWIO_EXTENSIONS, DRAWIO_INTERNAL_URI } from './drawio.constants'+import { DRAWIO_INTERNAL_URI, DRAWIO_SUPPORTED_EXTENSIONS } from './drawio.constants'import type { DrawioSettingsDto } from './drawio.dtos'@Injectable()@@ -21,7 +21,7 @@ export class DrawioManager {throw new HttpException('Diagram must be a file', HttpStatus.BAD_REQUEST)}const extension = path.extname(space.realPath).slice(1).toLowerCase()- if (!DRAWIO_EXTENSIONS.has(extension)) {+ if (!DRAWIO_SUPPORTED_EXTENSIONS.has(extension)) {throw new HttpException('Diagram format not supported', HttpStatus.BAD_REQUEST)}diff --git a/backend/src/applications/files/editors/drawio/drawio.constants.ts b/backend/src/applications/files/editors/drawio/drawio.constants.tsindex 7bebd694..7e34d0fe 100644--- a/backend/src/applications/files/editors/drawio/drawio.constants.ts+++ b/backend/src/applications/files/editors/drawio/drawio.constants.ts@@ -1,4 +1,6 @@export const DRAWIO_INTERNAL_URI = '/drawio/' as constexport const DRAWIO_EXTENSIONS = new Set<string>(['drawio', 'dwb'])+export const DRAWIO_IMPORT_EXTENSIONS = new Set<string>(['vsdx', 'gliffy'])+export const DRAWIO_SUPPORTED_EXTENSIONS = new Set<string>([...DRAWIO_EXTENSIONS, ...DRAWIO_IMPORT_EXTENSIONS])export const EMPTY_DRAWIO_XML ='<mxfile><diagram name="Page-1"><mxGraphModel><root><mxCell id="0"/><mxCell id="1" parent="0"/></root></mxGraphModel></diagram></mxfile>'diff --git a/frontend/src/app/applications/files/components/dialogs/files-viewer-dialog.component.html b/frontend/src/app/applications/files/components/dialogs/files-viewer-dialog.component.htmlindex 3254b494..835096ba 100644--- a/frontend/src/app/applications/files/components/dialogs/files-viewer-dialog.component.html+++ b/frontend/src/app/applications/files/components/dialogs/files-viewer-dialog.component.html@@ -89,6 +89,7 @@@defer (on immediate) {<app-files-viewer-drawio[currentHeight]="currentHeight - 5"+ [directoryFiles]="directoryFiles"[file]="currentFile"[isWriteable]="isWriteable"[modalClosing]="modalClosing()"diff --git a/frontend/src/app/applications/files/components/viewers/components/files-viewer-save-as.component.ts b/frontend/src/app/applications/files/components/viewers/components/files-viewer-save-as.component.tsnew file mode 100644index 00000000..ee7ada90--- /dev/null+++ b/frontend/src/app/applications/files/components/viewers/components/files-viewer-save-as.component.ts@@ -0,0 +1,82 @@+import { Component, inject, Input, OnInit, output } from '@angular/core'+import { FormsModule } from '@angular/forms'+import { L10nTranslateDirective } from 'angular-l10n'+import { AutofocusDirective } from '../../../../../common/directives/auto-focus.directive'+import { LayoutService } from '../../../../../layout/layout.service'++@Component({+ selector: 'app-files-viewer-save-as',+ imports: [AutofocusDirective, FormsModule, L10nTranslateDirective],+ template: `+ <div class="modal-header">+ <h4 class="modal-title" l10nTranslate>Save in the current directory</h4>+ <button (click)="layout.closeDialog()" [disabled]="saving" aria-label="Close" class="btn-close btn-close-white" type="button"></button>+ </div>+ <div class="modal-body">+ <label class="form-label" for="drawio-file-name" l10nTranslate>File name</label>+ <div class="input-group">+ <input+ id="drawio-file-name"+ [(ngModel)]="fileName"+ (ngModelChange)="normalizeName()"+ (keyup.enter)="submit()"+ class="form-control"+ type="text"+ autocomplete="off"+ appAutofocus+ />+ <span class="input-group-text">.drawio</span>+ </div>+ </div>+ <div class="modal-footer">+ <div class="me-auto">+ @if (nameExists()) {+ <span class="text-danger fs-sm" l10nTranslate>This name is already used</span>+ } @else if (error) {+ <span class="text-danger fs-sm">{{ error }}</span>+ }+ </div>+ <button (click)="layout.closeDialog()" [disabled]="saving" class="btn btn-secondary" type="button" l10nTranslate>Cancel</button>+ <button (click)="submit()" [disabled]="!canSubmit()" class="btn btn-primary" type="button" l10nTranslate>Save</button>+ </div>+ `+})+export class FilesViewerSaveAsComponent implements OnInit {+ @Input({ required: true }) suggestedName: string+ @Input({ required: true }) existingNames: readonly string[] = []+ readonly confirmSave = output<string>()+ protected readonly layout = inject(LayoutService)+ protected fileName = ''+ protected saving = false+ protected error = ''++ ngOnInit() {+ this.fileName = this.suggestedName+ }++ setSaving(saving: boolean) {+ this.saving = saving+ }++ setError(error: string) {+ this.error = error+ }++ protected normalizeName() {+ this.fileName = this.fileName.replace(/\.drawio$/i, '')+ this.error = ''+ }++ protected nameExists(): boolean {+ const targetName = `${this.fileName.trim()}.drawio`.normalize().toLowerCase()+ return this.existingNames.some((name) => name.normalize().toLowerCase() === targetName)+ }++ protected canSubmit(): boolean {+ return !!this.fileName.trim() && !this.nameExists() && !this.saving+ }++ protected submit() {+ if (this.canSubmit()) this.confirmSave.emit(this.fileName.trim())+ }+}diff --git a/frontend/src/app/applications/files/components/viewers/files-viewer-drawio.component.ts b/frontend/src/app/applications/files/components/viewers/files-viewer-drawio.component.tsindex 24f3ad01..82e1fa88 100644--- a/frontend/src/app/applications/files/components/viewers/files-viewer-drawio.component.ts+++ b/frontend/src/app/applications/files/components/viewers/files-viewer-drawio.component.ts@@ -1,10 +1,18 @@import { HttpClient, HttpErrorResponse } from '@angular/common/http'-import { Component, ElementRef, HostListener, inject, OnDestroy, OnInit, signal, viewChild } from '@angular/core'+import { Component, ElementRef, HostListener, inject, input, OnDestroy, OnInit, signal, viewChild } from '@angular/core'import { DomSanitizer, SafeResourceUrl } from '@angular/platform-browser'import type { DrawioSettingsDto } from '@sync-in-server/backend/src/applications/files/editors/drawio/drawio.dtos'-import { EMPTY_DRAWIO_XML } from '@sync-in-server/backend/src/applications/files/editors/drawio/drawio.constants'+import { DRAWIO_IMPORT_EXTENSIONS, EMPTY_DRAWIO_XML } from '@sync-in-server/backend/src/applications/files/editors/drawio/drawio.constants'import { API_DRAWIO_SETTINGS } from '@sync-in-server/backend/src/applications/files/editors/drawio/drawio.routes'+import { forbiddenChars, isValidFileName } from '@sync-in-server/backend/src/common/shared'import { L10nTranslateDirective } from 'angular-l10n'+import type { BsModalRef } from 'ngx-bootstrap/modal'+import { firstValueFrom, take } from 'rxjs'+import { StoreService } from '../../../../store/store.service'+import { MAX_CLIENT_EDITOR_FILE_SIZE } from '../../files.constants'+import type { FileModel } from '../../models/file.model'+import { FilesUploadService } from '../../services/files-upload.service'+import { FilesViewerSaveAsComponent } from './components/files-viewer-save-as.component'import { FilesViewerUnsavedChangesComponent } from './components/files-viewer-unsaved-changes.component'import { FilesViewerEditableBase } from './files-viewer-editable-base'import type { DrawioEditorEvent } from './interfaces/files-viewer-drawio.interface'@@ -25,7 +33,10 @@ import type { DrawioEditorEvent } from './interfaces/files-viewer-drawio.interfa}.drawio-viewer__state {- height: 100%;+ position: absolute;+ z-index: 1;+ inset: 0;+ background: var(--bs-body-bg);}`],@@ -38,7 +49,7 @@ import type { DrawioEditorEvent } from './interfaces/files-viewer-drawio.interfa</div>} @else if (loadFailed()) {<div class="drawio-viewer__state d-flex align-items-center justify-content-center p-4" l10nTranslate>Unable to open document</div>- } @else if (iframeSrc()) {+ } @else {@if (warnOnUnsavedChanges()) {<app-files-viewer-unsaved-changes[saving]="isSaving()"@@ -47,6 +58,8 @@ import type { DrawioEditorEvent } from './interfaces/files-viewer-drawio.interfa(keepEditing)="warnOnUnsavedChanges.set(false)"/>}+ }+ @if (iframeSrc()) {@if (isExternalEditor()) {<iframe#editorFrame@@ -75,13 +88,18 @@ import type { DrawioEditorEvent } from './interfaces/files-viewer-drawio.interfa`})export class FilesViewerDrawioComponent extends FilesViewerEditableBase implements OnInit, OnDestroy {+ directoryFiles = input.required<FileModel[]>()protected readonly loading = signal(true)protected readonly loadFailed = signal(false)protected readonly iframeSrc = signal<SafeResourceUrl | null>(null)protected readonly isExternalEditor = signal(false)+ protected existingFileNames: string[] = []+ protected suggestedFileName = ''private readonly editorFrame = viewChild<ElementRef<HTMLIFrameElement>>('editorFrame')private readonly httpClient = inject(HttpClient)private readonly sanitizer = inject(DomSanitizer)+ private readonly filesUploadService = inject(FilesUploadService)+ private readonly store = inject(StoreService)private content = ''private savedContent = ''private editorOrigin = 'null'@@ -91,12 +109,18 @@ export class FilesViewerDrawioComponent extends FilesViewerEditableBase implemenprivate savePending = falseprivate closeAfterSave = falseprivate closeCheckPending = false+ private importInitializing = false+ private saveAsModalRef: BsModalRef<FilesViewerSaveAsComponent> | null = nullconstructor() {super()}ngOnInit() {+ if (this.isImportedFormat()) {+ this.existingFileNames = this.directoryFiles().map((file) => file.name)+ this.suggestedFileName = this.getSuggestedFileName()+ }this.httpClient.get<DrawioSettingsDto>(`${API_DRAWIO_SETTINGS}/${this.file().encodedPath}`).subscribe({next: (settings) => {try {@@ -108,7 +132,11 @@ export class FilesViewerDrawioComponent extends FilesViewerEditableBase implementhis.isExternalEditor.set(true)}this.isSupported.set(true)- this.loadContent().catch(console.error)+ if (this.isImportedFormat()) {+ this.loadImportedContent().catch((e) => this.handleLoadError(e))+ } else {+ this.loadContent().catch(console.error)+ }} catch (e) {this.handleLoadError(e)}@@ -141,18 +169,27 @@ export class FilesViewerDrawioComponent extends FilesViewerEditableBase implemen}breakcase 'init':- if (this.isReadonlyView()) return+ if (this.isReadonlyView() && !this.importInitializing) returnthis.postToEditor({ action: 'load', xml: this.content, autosave: 1, title: this.file().name })- if (this.isModified()) this.persist()+ if (!this.importInitializing && this.isModified()) this.persist()+ break+ case 'load':+ if (data.error) {+ this.handleLoadError(data.message || data.error)+ } else if (this.importInitializing) {+ this.postToEditor({ action: 'export', format: 'xml' })+ }breakcase 'save':if (typeof data.xml === 'string') this.queueSave(data.xml, data.exit === true)breakcase 'autosave':- if (typeof data.xml === 'string') this.trackChanges(data.xml)+ if (!this.importInitializing && typeof data.xml === 'string') this.trackChanges(data.xml)breakcase 'export':- if (this.closeCheckPending && typeof data.xml === 'string') {+ if (this.importInitializing && typeof data.xml === 'string') {+ this.completeImport(data.xml)+ } else if (this.closeCheckPending && typeof data.xml === 'string') {this.closeCheckPending = falsethis.trackChanges(data.xml)super.requestClose()@@ -210,6 +247,10 @@ export class FilesViewerDrawioComponent extends FilesViewerEditableBase implemenprotected saveAndExit() {this.warnOnUnsavedChanges.set(false)+ if (this.isImportedFormat()) {+ this.openSaveAs()+ return+ }this.closeAfterSave = trueif (this.isSaving()) returnif (this.isModified()) {@@ -224,7 +265,7 @@ export class FilesViewerDrawioComponent extends FilesViewerEditableBase implemenconst editorUrl = new URL(this.editorServerUrl)editorUrl.searchParams.set('dark', this.currentTheme === 'dark' ? '1' : '0')editorUrl.searchParams.set('lang', this.locale.language)- if (this.isReadonlyView()) {+ if (this.isReadonlyView() && !this.importInitializing) {editorUrl.searchParams.set('chrome', '0')editorUrl.searchParams.set('lightbox', '1')editorUrl.searchParams.set('layers', '1')@@ -247,6 +288,10 @@ export class FilesViewerDrawioComponent extends FilesViewerEditableBase implemenprivate queueSave(xml: string, exit: boolean) {if (this.isReadonly() || !this.isWriteable()) returnthis.trackChanges(xml)+ if (this.isImportedFormat()) {+ this.openSaveAs()+ return+ }this.closeAfterSave ||= exitif (this.isSaving()) {this.savePending = true@@ -267,7 +312,7 @@ export class FilesViewerDrawioComponent extends FilesViewerEditableBase implemen}protected override requestClose() {- if (this.isSaving() || this.closeCheckPending) return+ if (this.isSaving() || this.closeCheckPending || this.saveAsModalRef) returnif (this.isReadonlyView()) {super.requestClose()return@@ -277,10 +322,123 @@ export class FilesViewerDrawioComponent extends FilesViewerEditableBase implementhis.postToEditor({ action: 'export', format: 'xml' })}+ protected override usesFileLock(): boolean {+ return !this.isImportedFormat()+ }+private persist() {this.save()}+ protected saveImportedFile(baseName: string) {+ if (!this.isImportedFormat() || this.isSaving()) return+ const fileName = `${baseName}.drawio`+ try {+ isValidFileName(fileName)+ } catch (e: any) {+ this.saveAsModalRef?.content?.setError(`${this.layout.translateString(e.message)} : ${forbiddenChars}`)+ return+ }+ if (new Blob([this.content]).size >= MAX_CLIENT_EDITOR_FILE_SIZE) {+ this.saveAsModalRef?.content?.setError(this.layout.translateString('File size limit exceeded'))+ return+ }++ const directoryPath = this.file().path.split('/').slice(0, -1).join('/') || '.'+ this.isSaving.set(true)+ this.saveAsModalRef?.content?.setSaving(true)+ this.saveAsModalRef?.content?.setError('')+ this.filesUploadService.uploadNewFileContent(directoryPath, fileName, this.content).subscribe({+ next: () => {+ this.isSaving.set(false)+ this.isModified.set(false)+ if (this.saveAsModalRef?.id != null) this.layout.closeDialog(null, this.saveAsModalRef.id)+ this.onClose()+ .then(() => this.store.filesOnEvent.next({ filePath: directoryPath, fileName, focus: true, reload: true, openAfterCreate: true }))+ .catch(console.error)+ },+ error: (e: HttpErrorResponse) => {+ this.isSaving.set(false)+ this.saveAsModalRef?.content?.setSaving(false)+ this.saveAsModalRef?.content?.setError(+ e.status === 405 ? this.layout.translateString('This name is already used') : e.error?.message || e.message+ )+ }+ })+ }++ private async loadImportedContent() {+ const extension = this.file().getExtension()+ if (extension === 'vsdx') {+ const content = await firstValueFrom(this.httpClient.get(this.file().dataUrl, { responseType: 'arraybuffer' }))+ this.content = await this.toDataUrl(content, 'application/vnd.visio')+ } else {+ this.content = await firstValueFrom(this.httpClient.get(this.file().dataUrl, { responseType: 'text' }))+ }+ this.importInitializing = true+ this.configureIframe()+ }++ private completeImport(xml: string) {+ this.importInitializing = false+ this.content = xml+ this.savedContent = xml+ this.isModified.set(false)+ this.postToEditor({ action: 'status', message: '', modified: false })+ if (this.isReadonlyView()) this.configureIframe()+ this.loading.set(false)+ }++ private openSaveAs() {+ if (this.saveAsModalRef) return+ this.warnOnUnsavedChanges.set(false)+ const modalRef: BsModalRef<FilesViewerSaveAsComponent> = this.layout.openDialog(+ FilesViewerSaveAsComponent,+ 'sm',+ {+ initialState: {+ existingNames: this.existingFileNames,+ suggestedName: this.suggestedFileName+ } satisfies Partial<FilesViewerSaveAsComponent>+ },+ { keyboard: false }+ )+ this.saveAsModalRef = modalRef+ const confirmSubscription = modalRef.content!.confirmSave.subscribe((baseName: string) => this.saveImportedFile(baseName))+ modalRef.onHidden?.pipe(take(1)).subscribe(() => {+ confirmSubscription.unsubscribe()+ if (this.saveAsModalRef !== modalRef) return+ this.saveAsModalRef = null+ this.postToEditor({ action: 'status', message: '', modified: this.isModified() })+ })+ }++ private getSuggestedFileName(): string {+ const sourceName = this.file().name+ const extensionIndex = sourceName.lastIndexOf('.')+ const baseName = extensionIndex > 0 ? sourceName.slice(0, extensionIndex) : sourceName+ const existingNames = new Set(this.existingFileNames.map((name) => name.normalize().toLowerCase()))+ let candidate = baseName+ let suffix = 1+ while (existingNames.has(`${candidate}.drawio`.normalize().toLowerCase())) {+ candidate = `${baseName} (${suffix++})`+ }+ return candidate+ }++ private isImportedFormat(): boolean {+ return DRAWIO_IMPORT_EXTENSIONS.has(this.file().getExtension())+ }++ private toDataUrl(content: ArrayBuffer, mime: string): Promise<string> {+ return new Promise((resolve, reject) => {+ const reader = new FileReader()+ reader.onload = () => resolve(reader.result as string)+ reader.onerror = () => reject(reader.error)+ reader.readAsDataURL(new Blob([content], { type: mime }))+ })+ }+private postToEditor(message: object) {const targetOrigin = this.editorOrigin === 'null' ? '*' : this.editorOriginthis.editorFrame()?.nativeElement.contentWindow?.postMessage(JSON.stringify(message), targetOrigin)diff --git a/frontend/src/app/applications/files/components/viewers/files-viewer-editable-base.ts b/frontend/src/app/applications/files/components/viewers/files-viewer-editable-base.tsindex bcb9e2f5..47b50151 100644--- a/frontend/src/app/applications/files/components/viewers/files-viewer-editable-base.ts+++ b/frontend/src/app/applications/files/components/viewers/files-viewer-editable-base.ts@@ -72,7 +72,7 @@ export abstract class FilesViewerEditableBase implements AfterViewInit, OnDestrothis.stopLockRefresh()this.isDestroyed = true// Fallback for programmatic closes that bypass onClose().- if (!this.isReadonly() && this.file().lock) {+ if (this.usesFileLock() && !this.isReadonly() && this.file().lock) {void this.unlockFile()}}@@ -160,6 +160,10 @@ export abstract class FilesViewerEditableBase implements AfterViewInit, OnDestroreturn !document.activeElement?.closest('.files-viewer-search')}+ protected usesFileLock(): boolean {+ return true+ }+protected requestClose(): void {const fileId = this.file().idif (this.isModified()) {@@ -182,7 +186,7 @@ export abstract class FilesViewerEditableBase implements AfterViewInit, OnDestroprotected async onClose() {if (this.isSaving()) return- if (!this.isReadonly() && !(await this.unlockFile())) return+ if (this.usesFileLock() && !this.isReadonly() && !(await this.unlockFile())) returnthis.layout.closeDialog(null, this.file().id)}diff --git a/frontend/src/app/applications/files/components/viewers/interfaces/files-viewer-drawio.interface.ts b/frontend/src/app/applications/files/components/viewers/interfaces/files-viewer-drawio.interface.tsindex 4eed8e6b..2d2bff89 100644--- a/frontend/src/app/applications/files/components/viewers/interfaces/files-viewer-drawio.interface.ts+++ b/frontend/src/app/applications/files/components/viewers/interfaces/files-viewer-drawio.interface.ts@@ -1,5 +1,7 @@export interface DrawioEditorEvent {event: string+ error?: boolean | stringexit?: boolean+ message?: stringxml?: string}diff --git a/frontend/src/app/applications/files/models/file.model.ts b/frontend/src/app/applications/files/models/file.model.tsindex 192d8d60..bcbe5c4f 100644--- a/frontend/src/app/applications/files/models/file.model.ts+++ b/frontend/src/app/applications/files/models/file.model.ts@@ -5,7 +5,7 @@ import {} from '@sync-in-server/backend/src/applications/files/constants/routes'import type { FileLockProps, FileProps } from '@sync-in-server/backend/src/applications/files/interfaces/file-props.interface'import { COLLABORA_ONLINE_EXTENSIONS } from '@sync-in-server/backend/src/applications/files/editors/collabora-online/collabora-online.constants'-import { DRAWIO_EXTENSIONS } from '@sync-in-server/backend/src/applications/files/editors/drawio/drawio.constants'+import { DRAWIO_SUPPORTED_EXTENSIONS } from '@sync-in-server/backend/src/applications/files/editors/drawio/drawio.constants'import type { FileEditorProviders } from '@sync-in-server/backend/src/applications/files/editors/file-editor-providers.interface'import { ONLY_OFFICE_EXTENSIONS } from '@sync-in-server/backend/src/applications/files/editors/only-office/only-office.constants'import type { File } from '@sync-in-server/backend/src/applications/files/schemas/file.interface'@@ -182,7 +182,7 @@ export class FileModel implements File {const dash = mime?.indexOf('-') ?? -1const temporaryMime = mime && dash >= 0 ? mime.slice(0, dash) : mime- if (editorConfig.drawio === true && DRAWIO_EXTENSIONS.has(extension)) {+ if (editorConfig.drawio === true && DRAWIO_SUPPORTED_EXTENSIONS.has(extension)) {this.shortMime = SHORT_MIME.DIAGRAMthis.isEditable = truethis.isViewable = truediff --git a/frontend/src/app/applications/files/services/files-upload.service.ts b/frontend/src/app/applications/files/services/files-upload.service.tsindex d1da3d92..75e501e4 100644--- a/frontend/src/app/applications/files/services/files-upload.service.ts+++ b/frontend/src/app/applications/files/services/files-upload.service.ts@@ -83,6 +83,12 @@ export class FilesUploadService {return this.http.request<void>(updateContent ? 'patch' : overwrite ? 'put' : 'post', url, { body: formData })}+ uploadNewFileContent(directoryPath: string, fileName: string, content: string) {+ const formData = new FormData()+ formData.append('file', new File([new Blob([content])], fileName, { type: 'application/x-drawio' }))+ return this.http.post<void>(`${API_FILES_OPERATION_UPLOAD}/${directoryPath}/${fileName}`, formData)+ }+private uploadFiles(url: string, form: FormData, overwrite: boolean) {return this.http.request(overwrite ? 'put' : 'post', url, {body: form,