From c08af91d34665855100c969bad9fddbf2182af41 Mon Sep 17 00:00:00 2001 From: Syndamia Date: Thu, 4 Feb 2021 14:10:21 +0200 Subject: Improved handling and detection of file types in post attachments --- .../src/app/components/post-attachment/post-attachment.component.html | 4 ++-- .../src/app/components/post-attachment/post-attachment.component.ts | 4 +++- 2 files changed, 5 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/DevHive.Angular/src/app/components/post-attachment/post-attachment.component.html b/src/DevHive.Angular/src/app/components/post-attachment/post-attachment.component.html index a8ebce7..4d381d1 100644 --- a/src/DevHive.Angular/src/app/components/post-attachment/post-attachment.component.html +++ b/src/DevHive.Angular/src/app/components/post-attachment/post-attachment.component.html @@ -10,8 +10,8 @@
- - Download attachment + + Download attachment
diff --git a/src/DevHive.Angular/src/app/components/post-attachment/post-attachment.component.ts b/src/DevHive.Angular/src/app/components/post-attachment/post-attachment.component.ts index 6c468b0..1d00def 100644 --- a/src/DevHive.Angular/src/app/components/post-attachment/post-attachment.component.ts +++ b/src/DevHive.Angular/src/app/components/post-attachment/post-attachment.component.ts @@ -7,6 +7,7 @@ import { Component, Input, OnInit } from '@angular/core'; }) export class PostAttachmentComponent implements OnInit { @Input() paramURL: string; + public isImage = false; public showFull = false; public fileName: string; public fileType: string; @@ -15,7 +16,8 @@ export class PostAttachmentComponent implements OnInit { { } ngOnInit(): void { - this.fileType = this.paramURL.includes('image') ? 'img' : 'raw'; + this.isImage = this.paramURL.includes('image') && !this.paramURL.endsWith('pdf'); + this.fileType = this.isImage ? 'img' : 'raw'; this.fileName = this.paramURL.match('(?<=\/)(?:.(?!\/))+$')?.pop() ?? 'Attachment'; } -- cgit v1.2.3