@trailstash/ultra 5.0.1 → 5.0.2

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/queryParams.js +13 -0
  2. package/package.json +1 -1
@@ -62,6 +62,9 @@ export const getQueryFromQueryParams = () => {
62
62
  // query
63
63
  if (params.has("q")) {
64
64
  query = decompressFromEncodedURIComponent(params.get("q"));
65
+ if (!query) {
66
+ alert("Invalid compressed query specified in URL");
67
+ }
65
68
  } else if (params.has("query")) {
66
69
  query = params.get("query");
67
70
  if (query.startsWith("gist:")) {
@@ -111,6 +114,16 @@ export const getOptionsFromQueryParams = () => {
111
114
  };
112
115
 
113
116
  export const getAutoRunFromQueryParams = () => {
117
+ // Don't autorun if provided query can't be decompressed
118
+ // TODO: other query load errors?
119
+ const params = new URLSearchParams(window.location.hash.slice(1));
120
+ if (params.has("q")) {
121
+ const query = decompressFromEncodedURIComponent(params.get("q"));
122
+ if (!query) {
123
+ return false;
124
+ }
125
+ }
126
+
114
127
  return new URLSearchParams(window.location.hash.slice(1)).has("run");
115
128
  };
116
129
 
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "publishConfig": {
4
4
  "access": "public"
5
5
  },
6
- "version": "5.0.1",
6
+ "version": "5.0.2",
7
7
  "description": "A web based tool for making MapLibre GL maps with data from sources such as Overpass, GeoJSON, GPX, KML, TCX, etc",
8
8
  "main": "index.js",
9
9
  "scripts": {