@sendsafely/sendsafely 1.1.9 → 2.0.0

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/lib/Dropzone.js CHANGED
@@ -1,5 +1,5 @@
1
1
  const URL = require('url').URL;
2
- const Window = require('window');
2
+ const Window = require('./window');
3
3
  const window = new Window();
4
4
  const $ = require('jquery')(window);
5
5
  const XMLHttpRequest = require('xmlhttprequest').XMLHttpRequest;
package/lib/SendSafely.js CHANGED
@@ -1,5 +1,5 @@
1
1
  const URL = require('url').URL;
2
- const Window = require('window');
2
+ const Window = require('./window');
3
3
  const window = new Window();
4
4
  const self = window;
5
5
  const sjcl = require("sjcl");
@@ -2408,7 +2408,11 @@ function DownloadAndDecryptFile (eventHandler, request, serverWorkerURI) {
2408
2408
 
2409
2409
  function getDownloadPathFromConfig(config, file) {
2410
2410
  var downloadPath = "";
2411
-
2411
+
2412
+ // sanitize file name to avoid conflicts with OS file systems
2413
+ config.fileName = config.fileName.replaceAll(/[<>:"\/\\|?*]/g, '_');
2414
+ file.fileName = file.fileName.replaceAll(/[<>:"\/\\|?*]/g, '_');
2415
+
2412
2416
  if (config.path && config.fileName) {
2413
2417
  downloadPath = path.join(config.path, config.fileName);
2414
2418
  } else if (config.path) {
package/lib/window.js ADDED
@@ -0,0 +1,16 @@
1
+ const {ResourceLoader, JSDOM} = require("jsdom");
2
+ // Class to return a window instance.
3
+ // Accepts a jsdom config object.
4
+ module.exports = class Window {
5
+ constructor(jsdomConfig = {}) {
6
+ const { proxy, strictSSL, userAgent } = jsdomConfig;
7
+ const resources = new ResourceLoader({
8
+ proxy,
9
+ strictSSL,
10
+ userAgent
11
+ });
12
+ return (new JSDOM('', Object.assign(jsdomConfig, {
13
+ resources
14
+ }))).window;
15
+ }
16
+ };
package/package.json CHANGED
@@ -1,7 +1,10 @@
1
1
  {
2
2
  "name": "@sendsafely/sendsafely",
3
- "version": "1.1.9",
3
+ "version": "2.0.0",
4
4
  "main": "./lib/SendSafely.js",
5
+ "engines": {
6
+ "node": ">=18"
7
+ },
5
8
  "scripts": {
6
9
  "test": "echo \"Error: no test specified\" && exit 1"
7
10
  },
@@ -10,10 +13,10 @@
10
13
  "description": "The SendSafely JavaScript SDK for Node.js lets you integrate SendSafely secure data transfer capabilities directly into your Node.js application.",
11
14
  "dependencies": {
12
15
  "jquery": "^3.4.1",
13
- "make-fetch-happen": "^10.2.1",
14
- "openpgp": "4.5.5",
15
- "sjcl": "^1.0.8",
16
- "window": "^4.2.7",
16
+ "jsdom": "^26.0.0",
17
+ "make-fetch-happen": "^11.1.1",
18
+ "openpgp": "4.10.11",
19
+ "sjcl": "1.0.8",
17
20
  "xmlhttprequest": "^1.8.0"
18
21
  },
19
22
  "repository": {