diff options
| author | Kamen Mladenov <kamen.d.mladenov@protonmail.com> | 2021-03-22 20:52:19 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-03-22 20:52:19 +0200 |
| commit | 0cbe73007b9112bf7aa76e2584cb1fafc272dd5b (patch) | |
| tree | 69b9916c17b6675a1e33b1a180d5eb0615e4fb87 /src/app/components/post-attachment/post-attachment.component.ts | |
| parent | 084238dfa39f31b3661362cbe8cdea44e8f05992 (diff) | |
| parent | cad20fc8c7d58860d7bf9c803da3a8fcea43396a (diff) | |
| download | DevHive-Angular-0cbe73007b9112bf7aa76e2584cb1fafc272dd5b.tar DevHive-Angular-0cbe73007b9112bf7aa76e2584cb1fafc272dd5b.tar.gz DevHive-Angular-0cbe73007b9112bf7aa76e2584cb1fafc272dd5b.zip | |
Merge pull request #3 from Team-Kaleidoscope/major-redesign
Major redesign
Diffstat (limited to 'src/app/components/post-attachment/post-attachment.component.ts')
| -rw-r--r-- | src/app/components/post-attachment/post-attachment.component.ts | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/app/components/post-attachment/post-attachment.component.ts b/src/app/components/post-attachment/post-attachment.component.ts index 1d00def..1aeca37 100644 --- a/src/app/components/post-attachment/post-attachment.component.ts +++ b/src/app/components/post-attachment/post-attachment.component.ts @@ -18,7 +18,12 @@ export class PostAttachmentComponent implements OnInit { ngOnInit(): void { this.isImage = this.paramURL.includes('image') && !this.paramURL.endsWith('pdf'); this.fileType = this.isImage ? 'img' : 'raw'; - this.fileName = this.paramURL.match('(?<=\/)(?:.(?!\/))+$')?.pop() ?? 'Attachment'; + if (this.fileType === 'img') { + this.fileName = this.paramURL.match(/(?!\/)+?[^\/]+?(?=\.)/g)?.pop() ?? 'Attachment'; + } + else { + this.fileName = this.paramURL.match(/[^\/]+?$/g)?.pop() ?? 'Attachment'; + } } toggleShowFull(): void { |
