diff options
Diffstat (limited to 'src/db/model')
| -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 { |
