Skip to content
Draft
Show file tree
Hide file tree
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
4 changes: 3 additions & 1 deletion apps/files_versions/src/utils/versions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -98,9 +98,11 @@ export async function restoreVersion(version: Version) {
*/
function formatVersion(version: Required<FileStat>, node: INode): Version {
const mtime = Date.parse(version.lastmod)
// server timestamps are seconds-based, we have to nullify the milliseconds
const nodeNormalizedMtime = Math.floor((node.mtime?.getTime() ?? 0) / 1000) * 1000

let previewUrl: string
if (mtime === node.mtime?.getTime()) { // Version is the current one
if (mtime === nodeNormalizedMtime) { // Version is the current one
previewUrl = generateUrl('/core/preview?fileId={fileId}&c={fileEtag}&x=250&y=250&forceIcon=0&a=0&forceIcon=1&mimeFallback=1', {
fileId: node.id,
fileEtag: node.attributes.etag,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ const loading = ref(false)
const showVersionLabelForm = ref(false)
const editedVersion = ref<Version | null>(null)

const currentVersionMtime = computed(() => props.node?.mtime?.getTime() ?? 0)
const currentVersionMtime = computed(() => Math.floor(new Date(props.node?.mtime?.getTime() ?? 0).getTime() / 1000) * 1000)

/**
* Order versions by mtime.
Expand Down