src/app/components/common/input/number/number.component.html
11
diff --git a/src-ui/src/app/components/common/input/file/file.component.html b/src-ui/src/app/components/common/input/file/file.component.html
index 121bda083..21d11e4f1 100644
--- a/src-ui/src/app/components/common/input/file/file.component.html
+++ b/src-ui/src/app/components/common/input/file/file.component.html
@@ -14,10 +14,17 @@
-
+
@if (filename) {
- {{filename}}
+
+ {{filename}}
+
+
}
@if (hint) {
diff --git a/src-ui/src/app/components/common/input/file/file.component.spec.ts b/src-ui/src/app/components/common/input/file/file.component.spec.ts
index ad3f70e41..86d135188 100644
--- a/src-ui/src/app/components/common/input/file/file.component.spec.ts
+++ b/src-ui/src/app/components/common/input/file/file.component.spec.ts
@@ -34,7 +34,7 @@ describe('FileComponent', () => {
let firedFile
component.file = new File([], 'test.png')
component.upload.subscribe((file) => (firedFile = file))
- component.onButton()
+ component.uploadClicked()
expect(firedFile.name).toEqual('test.png')
expect(component.file).toBeUndefined()
})
diff --git a/src-ui/src/app/components/common/input/file/file.component.ts b/src-ui/src/app/components/common/input/file/file.component.ts
index c27a009a4..0506dcc5b 100644
--- a/src-ui/src/app/components/common/input/file/file.component.ts
+++ b/src-ui/src/app/components/common/input/file/file.component.ts
@@ -39,9 +39,15 @@ export class FileComponent extends AbstractInputComponent {
this.file = (event.target as HTMLInputElement).files[0]
}
- onButton() {
+ uploadClicked() {
this.upload.emit(this.file)
+ this.clear()
+ }
+
+ clear() {
this.file = undefined
this.fileInput.nativeElement.value = null
+ this.writeValue(null)
+ this.onChange(null)
}
}
diff --git a/src-ui/src/app/services/config.service.spec.ts b/src-ui/src/app/services/config.service.spec.ts
index 0675da844..4fb24727f 100644
--- a/src-ui/src/app/services/config.service.spec.ts
+++ b/src-ui/src/app/services/config.service.spec.ts
@@ -48,4 +48,17 @@ describe('ConfigService', () => {
expect(req.request.method).toEqual('PATCH')
expect(req.request.body).not.toBeNull()
})
+
+ it('should not pass string app_logo', () => {
+ service
+ .saveConfig({
+ id: 1,
+ app_logo: '/logo/foobar.png',
+ } as PaperlessConfig)
+ .subscribe()
+ const req = httpTestingController.expectOne(
+ `${environment.apiBaseUrl}config/1/`
+ )
+ expect(req.request.body).toEqual({ id: 1 })
+ })
})
diff --git a/src-ui/src/app/services/config.service.ts b/src-ui/src/app/services/config.service.ts
index 5bc5f29c3..538aafbdd 100644
--- a/src-ui/src/app/services/config.service.ts
+++ b/src-ui/src/app/services/config.service.ts
@@ -20,6 +20,8 @@ export class ConfigService {
}
saveConfig(config: PaperlessConfig): Observable {
+ // dont pass string
+ if (typeof config.app_logo === 'string') delete config.app_logo
return this.http
.patch(`${this.baseUrl}${config.id}/`, config)
.pipe(first())