cloudmr-ux 1.3.6 → 1.3.8
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/dist/index.js +16 -2
- package/dist/index.mjs +16 -2
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -321,6 +321,7 @@ function CmrUploadWindow({
|
|
|
321
321
|
return;
|
|
322
322
|
return fileName.split(".").pop();
|
|
323
323
|
};
|
|
324
|
+
const INVALID_ALIAS_REGEX = /[ .,:%><]/;
|
|
324
325
|
const handleConfirm = () => {
|
|
325
326
|
if (uploadedFiles.length === 0) {
|
|
326
327
|
setInfoOpen(true);
|
|
@@ -336,6 +337,13 @@ function CmrUploadWindow({
|
|
|
336
337
|
setTimeout(() => setInfoOpen(false), 2500);
|
|
337
338
|
return;
|
|
338
339
|
}
|
|
340
|
+
if (INVALID_ALIAS_REGEX.test(fileAlias)) {
|
|
341
|
+
setInfoOpen(true);
|
|
342
|
+
setInfoStyle("error");
|
|
343
|
+
setWarningText("Alias contains invalid characters ( . , : % > < or spaces )");
|
|
344
|
+
setTimeout(() => setInfoOpen(false), 3e3);
|
|
345
|
+
return;
|
|
346
|
+
}
|
|
339
347
|
setOpen(false);
|
|
340
348
|
upload(uploadedFiles[0], fileAlias, locationSelection).then((response) => {
|
|
341
349
|
console.log(response);
|
|
@@ -400,7 +408,13 @@ function CmrUploadWindow({
|
|
|
400
408
|
setUpBtnText("Uploading");
|
|
401
409
|
};
|
|
402
410
|
const changeFileName = (e) => {
|
|
403
|
-
|
|
411
|
+
const value = e.target.value;
|
|
412
|
+
setFileAlias(value);
|
|
413
|
+
if (INVALID_ALIAS_REGEX.test(value)) {
|
|
414
|
+
setUploadBoxWarning("Alias cannot contain space, . , : % > <");
|
|
415
|
+
} else {
|
|
416
|
+
setUploadBoxWarning(void 0);
|
|
417
|
+
}
|
|
404
418
|
};
|
|
405
419
|
function loadFiles(files) {
|
|
406
420
|
if (files.length == 0) {
|
|
@@ -594,7 +608,7 @@ function CmrUploadWindow({
|
|
|
594
608
|
import_Button.default,
|
|
595
609
|
{
|
|
596
610
|
color: "inherit",
|
|
597
|
-
|
|
611
|
+
variant: "outlined",
|
|
598
612
|
disabled: UpBtnDisabled,
|
|
599
613
|
onClick: handleClose,
|
|
600
614
|
children: "Cancel"
|
package/dist/index.mjs
CHANGED
|
@@ -273,6 +273,7 @@ function CmrUploadWindow({
|
|
|
273
273
|
return;
|
|
274
274
|
return fileName.split(".").pop();
|
|
275
275
|
};
|
|
276
|
+
const INVALID_ALIAS_REGEX = /[ .,:%><]/;
|
|
276
277
|
const handleConfirm = () => {
|
|
277
278
|
if (uploadedFiles.length === 0) {
|
|
278
279
|
setInfoOpen(true);
|
|
@@ -288,6 +289,13 @@ function CmrUploadWindow({
|
|
|
288
289
|
setTimeout(() => setInfoOpen(false), 2500);
|
|
289
290
|
return;
|
|
290
291
|
}
|
|
292
|
+
if (INVALID_ALIAS_REGEX.test(fileAlias)) {
|
|
293
|
+
setInfoOpen(true);
|
|
294
|
+
setInfoStyle("error");
|
|
295
|
+
setWarningText("Alias contains invalid characters ( . , : % > < or spaces )");
|
|
296
|
+
setTimeout(() => setInfoOpen(false), 3e3);
|
|
297
|
+
return;
|
|
298
|
+
}
|
|
291
299
|
setOpen(false);
|
|
292
300
|
upload(uploadedFiles[0], fileAlias, locationSelection).then((response) => {
|
|
293
301
|
console.log(response);
|
|
@@ -352,7 +360,13 @@ function CmrUploadWindow({
|
|
|
352
360
|
setUpBtnText("Uploading");
|
|
353
361
|
};
|
|
354
362
|
const changeFileName = (e) => {
|
|
355
|
-
|
|
363
|
+
const value = e.target.value;
|
|
364
|
+
setFileAlias(value);
|
|
365
|
+
if (INVALID_ALIAS_REGEX.test(value)) {
|
|
366
|
+
setUploadBoxWarning("Alias cannot contain space, . , : % > <");
|
|
367
|
+
} else {
|
|
368
|
+
setUploadBoxWarning(void 0);
|
|
369
|
+
}
|
|
356
370
|
};
|
|
357
371
|
function loadFiles(files) {
|
|
358
372
|
if (files.length == 0) {
|
|
@@ -546,7 +560,7 @@ function CmrUploadWindow({
|
|
|
546
560
|
Button2,
|
|
547
561
|
{
|
|
548
562
|
color: "inherit",
|
|
549
|
-
|
|
563
|
+
variant: "outlined",
|
|
550
564
|
disabled: UpBtnDisabled,
|
|
551
565
|
onClick: handleClose,
|
|
552
566
|
children: "Cancel"
|