Skip to content

Commit

Permalink
fix(Uploader): The mtime should be a valid UNIX timestamp
Browse files Browse the repository at this point in the history
Make sure it is a valid timestamp (integer), so no decimals.

Signed-off-by: Ferdinand Thiessen <opensource@fthiessen.de>
  • Loading branch information
susnux committed Sep 4, 2024
1 parent 0146ba9 commit 236ff5e
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions lib/uploader.ts
Original file line number Diff line number Diff line change
Expand Up @@ -467,7 +467,7 @@ export class Uploader {
encodedDestinationFile,
{
...this._customHeaders,
'X-OC-Mtime': file.lastModified / 1000,
'X-OC-Mtime': Math.floor(file.lastModified / 1000),
'OC-Total-Length': file.size,
'Content-Type': 'application/octet-stream',
},
Expand Down Expand Up @@ -504,7 +504,7 @@ export class Uploader {
url: `${tempUrl}/.file`,
headers: {
...this._customHeaders,
'X-OC-Mtime': file.lastModified / 1000,
'X-OC-Mtime': Math.floor(file.lastModified / 1000),
'OC-Total-Length': file.size,
Destination: encodedDestinationFile,
},
Expand Down Expand Up @@ -550,7 +550,7 @@ export class Uploader {
undefined,
{
...this._customHeaders,
'X-OC-Mtime': file.lastModified / 1000,
'X-OC-Mtime': Math.floor(file.lastModified / 1000),
'Content-Type': file.type,
},
)
Expand Down

0 comments on commit 236ff5e

Please sign in to comment.