@shipstatic/drop 0.2.9 → 0.2.11

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 CHANGED
@@ -11700,7 +11700,7 @@ var require_mime_db = __commonJS({
11700
11700
  }
11701
11701
  });
11702
11702
 
11703
- // node_modules/.pnpm/@shipstatic+types@0.4.19/node_modules/@shipstatic/types/dist/index.js
11703
+ // node_modules/.pnpm/@shipstatic+types@0.4.21/node_modules/@shipstatic/types/dist/index.js
11704
11704
  var ErrorType;
11705
11705
  (function(ErrorType2) {
11706
11706
  ErrorType2["Validation"] = "validation_failed";
@@ -11815,7 +11815,9 @@ var formatFileSize = formatFileSize$1;
11815
11815
  function createProcessedFile(file, options) {
11816
11816
  const webkitPath = file.webkitRelativePath || "";
11817
11817
  const path = options?.path || (webkitPath && webkitPath.trim() ? webkitPath : file.name);
11818
- const type = file.type || getMimeType(path);
11818
+ const mimeFromDb = getMimeType(path);
11819
+ const mimeFromBrowser = file.type;
11820
+ const type = mimeFromDb || mimeFromBrowser;
11819
11821
  return {
11820
11822
  // ProcessedFile properties
11821
11823
  // Note: md5 is intentionally undefined - Ship SDK will calculate it during deployment
@@ -11980,7 +11982,9 @@ function useDrop(options) {
11980
11982
  const processedFiles = cleanFiles.map((file) => createProcessedFile(file));
11981
11983
  const finalFiles = stripPrefix ? stripCommonPrefix(processedFiles) : processedFiles;
11982
11984
  const filesForValidation = finalFiles.map((f) => {
11983
- const isUnknownType = !f.file.type || f.file.type === "application/octet-stream";
11985
+ const browserUnknown = !f.file.type || f.file.type === "application/octet-stream";
11986
+ const mimeDbUnknown = !f.type || f.type === "application/octet-stream";
11987
+ const isUnknownType = browserUnknown && mimeDbUnknown;
11984
11988
  if (isUnknownType) {
11985
11989
  const textFile = new File([f.file], f.file.name, {
11986
11990
  type: "text/plain",
@@ -11993,13 +11997,14 @@ function useDrop(options) {
11993
11997
  configurable: true
11994
11998
  });
11995
11999
  }
11996
- return { ...f, file: textFile };
12000
+ return { ...f, file: textFile, type: "text/plain" };
11997
12001
  }
11998
12002
  return f;
11999
12003
  });
12000
12004
  const validatableFiles = filesForValidation.map((f) => ({
12001
12005
  name: f.file.name,
12002
- type: f.file.type,
12006
+ type: f.type,
12007
+ // Use corrected MIME type from mime-db, not browser's File.type
12003
12008
  size: f.file.size,
12004
12009
  status: f.status,
12005
12010
  statusMessage: f.statusMessage