diff options
| author | jw255 | 2018-04-17 18:43:06 +0100 |
|---|---|---|
| committer | jw255 | 2018-04-17 18:43:06 +0100 |
| commit | 8f1837af9400ef0ef5c1cab1e853b46e11b1b76b (patch) | |
| tree | 20e504d4311d938a7569264341d96e8d1d1a934e /src/db/model/File.ts | |
| parent | World War Files - changed precondition + filled addSubFileToFolder() function... (diff) | |
| download | medicine-8f1837af9400ef0ef5c1cab1e853b46e11b1b76b.tar.gz medicine-8f1837af9400ef0ef5c1cab1e853b46e11b1b76b.zip | |
Files - now actually works
Diffstat (limited to 'src/db/model/File.ts')
| -rw-r--r-- | src/db/model/File.ts | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/src/db/model/File.ts b/src/db/model/File.ts index 193a785..8a12431 100644 --- a/src/db/model/File.ts +++ b/src/db/model/File.ts @@ -27,7 +27,7 @@ import { FileTypeName, mimes } from '../../files'; export default class File extends Model<File> { @AllowNull @Column - private nameInternal!: string; + public nameInternal!: string; @AllowNull @Column @@ -85,10 +85,14 @@ export default class File extends Model<File> { public set name(name: string) { this.nameInternal = name; - this.fullPathInternal = this.fullPathInternal.substring( - 0, - this.fullPathInternal.lastIndexOf('/') + 1 - ) + this.name; + if (this.fullPathInternal) { + this.fullPathInternal = this.fullPathInternal.substring( + 0, + this.fullPathInternal.lastIndexOf('/') + 1 + ) + this.name; + } else { + this.fullPathInternal = this.name; + } } public get fullPath(): string { |
