aboutsummaryrefslogtreecommitdiff
path: root/src/app
diff options
context:
space:
mode:
authorSyndamia <kamen.d.mladenov@protonmail.com>2021-03-20 11:18:56 +0200
committerSyndamia <kamen.d.mladenov@protonmail.com>2021-03-20 11:18:56 +0200
commit02bcae5062da7ec69b618e6ea1a46c795b687518 (patch)
treec42f756f1da5e6a7a99136a7471c6f0d57b7bd87 /src/app
parent9794489573eaa3cd8bdc853c9d67db5145e22fe4 (diff)
downloadDevHive-Angular-02bcae5062da7ec69b618e6ea1a46c795b687518.tar
DevHive-Angular-02bcae5062da7ec69b618e6ea1a46c795b687518.tar.gz
DevHive-Angular-02bcae5062da7ec69b618e6ea1a46c795b687518.zip
Updated filename regex in attachments
Diffstat (limited to 'src/app')
-rw-r--r--src/app/components/post-attachment/post-attachment.component.ts7
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 {