Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ACS-8818] Mime type icons are now updated with file names in the viewer #10506

Closed
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -334,6 +334,7 @@ export class AlfrescoViewerComponent implements OnChanges, OnInit {

const fileExtension = this.viewUtilService.getFileExtension(versionData ? versionData.name : nodeData.name);
this.fileName = versionData ? versionData.name : nodeData.name;
this.mimeType = mimeType;
const viewerType = this.viewUtilService.getViewerType(fileExtension, mimeType);

if (viewerType === 'unknown') {
Expand All @@ -348,13 +349,11 @@ export class AlfrescoViewerComponent implements OnChanges, OnInit {

const nodeMimeType = nodeData?.content?.mimeType;
const renditionMimeType = nodeRendition.mimeType;
mimeType = renditionMimeType || nodeMimeType;
this.mimeType = renditionMimeType || nodeMimeType;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we cover that with some small unit test case check?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure if a unit test would make a difference here really. If you see in the earlier code, this.mimetype would have anyways gotten updated in the same function execution in line num 357. We only added an assignment earlier in the function execution to make sure it gets updated in the same change detection cycle as the file name.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think with #10508 this PR might be obsolete, currently when renditions are generated with this approach the icon is changed twice and ultimately is not correct, the other fixes both issues

}
} else if (viewerType === 'media') {
this.tracks = await this.renditionService.generateMediaTracksRendition(this.nodeId);
}

this.mimeType = mimeType;
this.urlFileContent = urlFileContent + (this.cacheBusterNumber ? '&' + this.cacheBusterNumber : '');
this.sidebarRightTemplateContext.node = nodeData;
this.sidebarLeftTemplateContext.node = nodeData;
Expand Down
Loading