Skip to content

Commit

Permalink
ReportUtils: fix type errors
Browse files Browse the repository at this point in the history
  • Loading branch information
kidroca committed Jul 8, 2024
1 parent 30b8202 commit c72cb19
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/libs/ReportUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3707,20 +3707,20 @@ function getParsedComment(text: string, parsingDetails?: ParsingDetails): string
}

function getUploadingAttachmentHtml(file?: FileObject): string {
if (!file || typeof file.source !== 'string') {
if (!file || typeof file.uri !== 'string') {
return '';
}

// file.type is a known mime type like image/png, image/jpeg, video/mp4 etc.
if (file.type?.startsWith('image')) {
return `<img src="${file.source}" alt="${file.name}" data-optimistic-src="${file.source}" />`;
return `<img src="${file.uri}" alt="${file.name}" data-optimistic-src="${file.uri}" />`;
}
if (file.type?.startsWith('video')) {
return `<video src="${file.source}" data-optimistic-src="${file.source}">${file.name}</video>`;
return `<video src="${file.uri}" data-optimistic-src="${file.uri}">${file.name}</video>`;
}

// For all other types, we present a generic preview
return `<a href="${file.source}" data-expensify-source="${file.source}">${file.name}</a>`;
return `<a href="${file.uri}" data-expensify-source="${file.uri}">${file.name}</a>`;
}

function getReportDescriptionText(report: Report): string {
Expand Down

0 comments on commit c72cb19

Please sign in to comment.