@shipstatic/drop 2.16.1-beta.8 → 2.16.1-beta.9
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/README.md +1 -1
- package/dist/index.cjs +9 -5
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +10 -6
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -204,7 +204,7 @@ ShipStatic's own apps send a project to be built. That isn't part of the public
|
|
|
204
204
|
|
|
205
205
|
## ZIP handling
|
|
206
206
|
|
|
207
|
-
A **single** dropped ZIP is extracted and its contents deployed. ZIPs among several files are treated as ordinary files. Archive paths are sanitized against directory traversal (`../../config.json` → `config.json`). A ZIP that can't be opened is an error that names it
|
|
207
|
+
A **single** dropped ZIP is extracted and its contents deployed. ZIPs among several files are treated as ordinary files. Archive paths are sanitized against directory traversal (`../../config.json` → `config.json`). A ZIP that can't be read or opened is an error that names it.
|
|
208
208
|
|
|
209
209
|
## Without React
|
|
210
210
|
|
package/dist/index.cjs
CHANGED
|
@@ -821,7 +821,11 @@ function unzip(data, opts, cb) {
|
|
|
821
821
|
|
|
822
822
|
// src/zip.ts
|
|
823
823
|
async function extractZipToFiles(zipFile) {
|
|
824
|
-
const bytes = new Uint8Array(
|
|
824
|
+
const bytes = new Uint8Array(
|
|
825
|
+
await zipFile.arrayBuffer().catch(() => {
|
|
826
|
+
throw new Error(ship.unreadable(zipFile.name));
|
|
827
|
+
})
|
|
828
|
+
);
|
|
825
829
|
const entries = await new Promise((resolve, reject) => {
|
|
826
830
|
unzip(
|
|
827
831
|
bytes,
|
|
@@ -1103,7 +1107,7 @@ function useDrop({ ship }) {
|
|
|
1103
1107
|
setState((prev) => prev.isDragging ? { ...prev, isDragging: false } : prev);
|
|
1104
1108
|
const files = [];
|
|
1105
1109
|
const directories = [];
|
|
1106
|
-
let
|
|
1110
|
+
let unreadable3 = false;
|
|
1107
1111
|
for (const item of Array.from(e.dataTransfer.items)) {
|
|
1108
1112
|
if (item.kind !== "file") continue;
|
|
1109
1113
|
let entry;
|
|
@@ -1120,12 +1124,12 @@ function useDrop({ ship }) {
|
|
|
1120
1124
|
setRelativePath(file, file.name);
|
|
1121
1125
|
files.push(file);
|
|
1122
1126
|
} else {
|
|
1123
|
-
|
|
1127
|
+
unreadable3 = true;
|
|
1124
1128
|
}
|
|
1125
1129
|
}
|
|
1126
|
-
if (directories.length === 0 && files.length === 0 && !
|
|
1130
|
+
if (directories.length === 0 && files.length === 0 && !unreadable3) return;
|
|
1127
1131
|
await prepare(async () => {
|
|
1128
|
-
if (
|
|
1132
|
+
if (unreadable3) throw new Error(UNREADABLE_DROP);
|
|
1129
1133
|
await Promise.all(directories.map((d) => traverseFileTree(d.entry, files, d.path)));
|
|
1130
1134
|
return files;
|
|
1131
1135
|
});
|