5htp-core 0.3.6-1 → 0.3.6-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.
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "5htp-core",
3
3
  "description": "Convenient TypeScript framework designed for Performance and Productivity.",
4
- "version": "0.3.6-1",
4
+ "version": "0.3.6-2",
5
5
  "author": "Gaetan Le Gac (https://github.com/gaetanlegac)",
6
6
  "repository": "git://github.com/gaetanlegac/5htp-core.git",
7
7
  "license": "MIT",
@@ -345,7 +345,7 @@ export default class ClientRouter<
345
345
 
346
346
  } catch (e) {
347
347
  console.error(`Failed to fetch the route ${route.chunk}`, e);
348
- this.app.handleError(new Error("Failed to load content. Please make sure you're connected to Internet."));
348
+ this.app.handleError(new Error("Failed to load content. Please reload the page and try again."));
349
349
  throw e;
350
350
  }
351
351
 
@@ -170,7 +170,7 @@ export default class SQL extends Service<Config, Hooks, Application, Services> {
170
170
  return query;
171
171
  }
172
172
 
173
- public esc(data: any) {
173
+ public esc( data: any, forStorage: boolean = false ) {
174
174
 
175
175
  // JSON object
176
176
  // TODO: do it via datatypes.ts
@@ -178,6 +178,13 @@ export default class SQL extends Service<Config, Hooks, Application, Services> {
178
178
 
179
179
  if (data.constructor.name === "Object")
180
180
  data = safeStringify(data);
181
+
182
+ } else if (forStorage) {
183
+
184
+ // Format array values for storing
185
+ if (Array.isArray( data )) {
186
+ data = data.join(', ')
187
+ }
181
188
  }
182
189
 
183
190
  return mysql.escape(data);
@@ -474,7 +481,7 @@ export default class SQL extends Service<Config, Hooks, Application, Services> {
474
481
  const values: string[] = [];
475
482
  for (const col of colNames)
476
483
  if (col in entry)
477
- values.push( this.esc( entry[col] ));
484
+ values.push( this.esc( entry[col], true));
478
485
  else
479
486
  values.push("DEFAULT");
480
487