nodebb-plugin-cloudflare-r2 1.0.2 → 1.0.3

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/library.js +2 -13
  2. package/package.json +1 -1
package/library.js CHANGED
@@ -22,20 +22,9 @@ const fileModule = require.main.require('./src/file');
22
22
  const plugin = {};
23
23
  plugin._s3 = null;
24
24
 
25
- function stripWrappingQuotes(s) {
26
- if (s === undefined || s === null) return '';
27
- const t = String(s).trim();
28
- if ((t.startsWith('"') && t.endsWith('"')) || (t.startsWith("'") && t.endsWith("'"))) {
29
- return t.slice(1, -1).trim();
30
- }
31
- return t;
32
- }
33
-
34
25
  function env(name, def = '') {
35
26
  const v = process.env[name];
36
- if (v === undefined || v === null) return def;
37
- const out = stripWrappingQuotes(v);
38
- return out.length ? out : def;
27
+ return (v !== undefined && v !== null && String(v).length) ? String(v) : def;
39
28
  }
40
29
 
41
30
  function envBool(name, def = false) {
@@ -65,7 +54,7 @@ function getSettings() {
65
54
  accessKeyId: env('NODEBB_R2_ACCESS_KEY_ID'),
66
55
  secretAccessKey: env('NODEBB_R2_SECRET_ACCESS_KEY'),
67
56
  bucket: env('NODEBB_R2_BUCKET'),
68
- endpoint: (function(){ const e = env('NODEBB_R2_ENDPOINT'); return e && !/^https?:\/\//i.test(e) ? `https://${e}` : e; })(),
57
+ endpoint: env('NODEBB_R2_ENDPOINT'),
69
58
  region: env('NODEBB_R2_REGION', 'auto'),
70
59
  uploadPath: env('NODEBB_R2_UPLOAD_PATH', ''),
71
60
  host: env('NODEBB_R2_HOST', ''),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nodebb-plugin-cloudflare-r2",
3
- "version": "1.0.2",
3
+ "version": "1.0.3",
4
4
  "description": "NodeBB v4 upload provider for Cloudflare R2 (S3-compatible) using environment variables",
5
5
  "main": "library.js",
6
6
  "author": "You",