dbm-graph-api 1.1.40 → 1.1.42

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dbm-graph-api",
3
- "version": "1.1.40",
3
+ "version": "1.1.42",
4
4
  "main": "index.js",
5
5
  "type": "module",
6
6
  "scripts": {
@@ -13,7 +13,7 @@
13
13
  "dependencies": {
14
14
  "@aws-sdk/client-s3": "^3.741.0",
15
15
  "@aws-sdk/s3-request-presigner": "^3.741.0",
16
- "dbm": "^1.2.9",
16
+ "dbm": "^1.4.1",
17
17
  "mime": "^4.0.6",
18
18
  "sharp": "^0.33.5",
19
19
  "ws": "^8.18.0"
@@ -701,12 +701,16 @@ export const setupSite = function(aServer) {
701
701
  }
702
702
 
703
703
  let url = request.url;
704
+ let shouldRedirect = false;
704
705
  let index = url.indexOf("?");
706
+ let queryString = null;
705
707
  if(index >= 0) {
708
+ queryString = url.substring(index, url.length);
706
709
  url = url.substring(0, index);
707
710
  }
708
711
  if(url[url.length-1] !== "/") {
709
712
  url += "/";
713
+ shouldRedirect = true;
710
714
  }
711
715
 
712
716
  let urlObject = await database.getObjectByUrl(url);
@@ -715,6 +719,13 @@ export const setupSite = function(aServer) {
715
719
  moduleName = request.query.forceModule;
716
720
  }
717
721
 
722
+ if(urlObject && shouldRedirect) {
723
+ let newUrl = url;
724
+ if(queryString) {
725
+ newUrl += queryString;
726
+ }
727
+ return reply.redirect(newUrl, 301);
728
+ }
718
729
  if(!urlObject) {
719
730
  reply.code(404);
720
731
  reply.type('text/html');