Skip to content

File Previews don't show in page if a draft version exists #6419

@qqmyers

Description

@qqmyers

When viewing an unrestricted file in a published dataset, if a draft dataset exists, the preview tab does not display. And, if that is fixed, the previewer tries to load the draft dataset version and fails.

Digging in, it looks like there are two places where getLastestFilemetadata is getting called (directly or indirectly) and leading to these failures. In the FilePage, the init() method correctly picks the filemetadata for the requested version, but the preview() method was using file.getFileMetadata() which gets the draft version. (The second issue above).
In file.xhtml, there is a render check requiring the FilePage.filemetadata.datasetversion (e.g. 1.0) to be equal to the latestversion of the dataset (e.g. draft in this case).

I'll submit a PR with updates for both which work for me to make the preview tab show for this case. (Question - was the design to not allow prior versions to be previewed? I.e. is checking that the datasetversion is the latest public version what was intended?).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions