diff --git a/.changelog/23625.txt b/.changelog/23625.txt new file mode 100644 index 000000000..d7c5dd463 --- /dev/null +++ b/.changelog/23625.txt @@ -0,0 +1,3 @@ +```release-note:bug +ui: Fixed storage/plugin 404s by unescaping a slash character in the request URL +``` diff --git a/ui/app/adapters/plugin.js b/ui/app/adapters/plugin.js index 36e0ba85b..ab23f9573 100644 --- a/ui/app/adapters/plugin.js +++ b/ui/app/adapters/plugin.js @@ -11,4 +11,11 @@ export default class PluginAdapter extends Watchable { queryParamsToAttrs = { type: 'type', }; + // Over in serializers/plugin.js, we prepend csi/ as part of the hash ID for request resolution reasons. + // However, this is not part of the actual ID stored in the database and we should treat it like a regular, unescaped + // path segment. + urlForFindRecord() { + let url = super.urlForFindRecord(...arguments); + return url.replace('csi%2F', 'csi/'); + } } diff --git a/ui/mirage/config.js b/ui/mirage/config.js index 0375daece..dcb3155e8 100644 --- a/ui/mirage/config.js +++ b/ui/mirage/config.js @@ -673,13 +673,8 @@ export default function () { return this.serialize(csiPlugins.all()); }); - this.get('/plugin/:id', function ({ csiPlugins }, { params }) { - if (!params.id.startsWith('csi/')) { - return new Response(404, {}, null); - } - - const id = params.id.replace(/^csi\//, ''); - const volume = csiPlugins.find(id); + this.get('/plugin/csi/:id', function ({ csiPlugins }, { params }) { + const volume = csiPlugins.find(params.id); if (!volume) { return new Response(404, {}, null);