diff options
| author | Tom Harley | 2018-04-19 14:59:28 +0100 |
|---|---|---|
| committer | Tom Harley | 2018-04-19 14:59:28 +0100 |
| commit | 830ac925c9248d77d55d221887b7a41fd205312d (patch) | |
| tree | 7e21befd060b2f215d0629ef26bf967db29c09b0 /src/db/model | |
| parent | Fix tests for matcher, and minor import edits (diff) | |
| parent | no reset (diff) | |
| download | medicine-830ac925c9248d77d55d221887b7a41fd205312d.tar.gz medicine-830ac925c9248d77d55d221887b7a41fd205312d.zip | |
Merge branch ‘trh/gets’ of gitlab.cs.st-andrews.ac.uk:cs3099group-be-4/project-code into trh/gets
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 { |
