-
Notifications
You must be signed in to change notification settings - Fork 254
š use SUR date instead of the infostore one to have an update LastMod⦠#6121
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
Changes from all commits
d9a5aed
4a70cf7
225cf9c
b779f1f
63a33eb
19a1ee8
9524559
6f9012b
78fd519
3f4a308
7554628
dbedc1f
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
DarkIsDude marked this conversation as resolved.
Show resolved
Hide resolved
|
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -1,7 +1,5 @@ | ||||||
| const xml2js = require('xml2js'); | ||||||
| const { errors } = require('arsenal'); | ||||||
| const metadata = require('../../metadata/wrapper'); | ||||||
| const { getResponseHeader, buildHeadXML, getFileToBuild } = require('./utils'); | ||||||
| const { getResponseHeader, buildVeeamFileData } = require('./utils'); | ||||||
| const { responseXMLBody, responseContentHeaders } = require('arsenal/build/lib/s3routes/routesUtils'); | ||||||
|
|
||||||
| /** | ||||||
|
|
@@ -13,31 +11,23 @@ const { responseXMLBody, responseContentHeaders } = require('arsenal/build/lib/s | |||||
| * @param {object} log - logger object | ||||||
| * @returns {undefined} - | ||||||
| */ | ||||||
| function headVeeamFile(request, response, bucketMd, log) { | ||||||
| async function headVeeamFile(request, response, bucketMd, log) { | ||||||
| if (!bucketMd) { | ||||||
| return responseXMLBody(errors.NoSuchBucket, null, response, log); | ||||||
| } | ||||||
| return metadata.getBucket(request.bucketName, log, (err, data) => { | ||||||
| if (err) { | ||||||
| return responseXMLBody(errors.InternalError, null, response, log); | ||||||
| } | ||||||
| const fileToBuild = getFileToBuild(request, data._capabilities?.VeeamSOSApi); | ||||||
| if (fileToBuild.error) { | ||||||
| return responseXMLBody(fileToBuild.error, null, response, log); | ||||||
| } | ||||||
| let modified = new Date().toISOString(); | ||||||
| // Extract the last modified date, but do not include it when computing | ||||||
| // the file's ETag (md5) | ||||||
| modified = fileToBuild.value.LastModified; | ||||||
| delete fileToBuild.value.LastModified; | ||||||
| // Recompute file content to generate appropriate content-md5 header | ||||||
| const builder = new xml2js.Builder({ | ||||||
| headless: true, | ||||||
| }); | ||||||
| const dataBuffer = Buffer.from(buildHeadXML(builder.buildObject(fileToBuild))); | ||||||
| return responseContentHeaders(null, {}, getResponseHeader(request, data, | ||||||
| dataBuffer, modified, log), response, log); | ||||||
| }); | ||||||
|
|
||||||
DarkIsDude marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||
| try { | ||||||
| const result = await buildVeeamFileData(request, bucketMd, log); | ||||||
| return responseContentHeaders( | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. š¬ š
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @francoisferrand that's not an async method ? |
||||||
| null, | ||||||
| {}, | ||||||
| getResponseHeader(request, result.bucketData, result.dataBuffer, result.modified, log), | ||||||
| response, | ||||||
| log, | ||||||
| ); | ||||||
| } catch (err) { | ||||||
| return responseXMLBody(err, null, response, log); | ||||||
| } | ||||||
| } | ||||||
|
|
||||||
| module.exports = headVeeamFile; | ||||||
Uh oh!
There was an error while loading. Please reload this page.