Skip to content

Commit

Permalink
Use the ACL template in case of unexpected content type anyway
Browse files Browse the repository at this point in the history
This also adds `text/xml` as possible content type.
  • Loading branch information
LukasKalbertodt committed Mar 26, 2020
1 parent 6128da9 commit d100e14
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 d100e14

Please sign in to comment.