Skip to content

Commit

Permalink
Merge pull request #514 from LukasKalbertodt/fix-acl-xml-type
Browse files Browse the repository at this point in the history
Use the ACL template in case of unexpected content type anyway
  • Loading branch information
LukasKalbertodt authored Mar 26, 2020
2 parents 6128da9 + d100e14 commit dd4bb6c
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions src/settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -225,13 +225,14 @@ export class SettingsManager {
return;
}

if (!response.headers.get('Content-Type').startsWith('application/xml')) {
// Warn if the content type of the request is unexpected. We still use the
// response as, opposed to `settings.xml`, the path is explicitly set.
const contentType = response.headers.get('Content-Type');
if (!contentType.startsWith('application/xml') && !contentType.startsWith('text/xml')) {
console.warn(
`ACL template request '${url}' does not have 'Content-Type: application/xml'. `
+ `Using default ACLs.`
`ACL template request '${url}' does not have 'Content-Type: application/xml' or 'Content-Type: text/xml'. `
+ `This could be a bug. Using the response as ACL template anyway.`
);
uploadSettings.acl = true;
return null;
}

// Finally, set the setting to the template string.
Expand Down

0 comments on commit dd4bb6c

Please sign in to comment.