amphora 8.4.0 → 8.4.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/lib/render.js +5 -1
  2. package/package.json +1 -1
package/lib/render.js CHANGED
@@ -286,7 +286,11 @@ function renderExpressRoute(req, res, next) {
286
286
  var hrStart = process.hrtime(),
287
287
  site = res.locals.site,
288
288
  prefix = `${getExpressRoutePrefix(site)}/_uris/`,
289
- pageReference = `${prefix}${buf.encode(req.hostname + req.baseUrl + req.path)}`;
289
+ // We're using decodeURIComponent to match any encoded value that might be sent by the browser.
290
+ // An example of this is a smart quote ’ -- That value is going to be encoded to `%E2%80%99`.
291
+ // We store the actual symbol in our database, not the encoded value, so, when decoding it, we ensure we can get the direct symbol
292
+ // and, in consequence, the page we're looking for.
293
+ pageReference = `${prefix}${buf.encode(req.hostname + req.baseUrl + decodeURIComponent(req.path))}`;
290
294
 
291
295
  return module.exports.renderUri(pageReference, req, res, hrStart)
292
296
  .catch((error) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "amphora",
3
- "version": "8.4.0",
3
+ "version": "8.4.1",
4
4
  "description": "An API mixin for Express that saves, publishes and composes data with the key-value store of your choice.",
5
5
  "main": "index.js",
6
6
  "scripts": {