@shipstatic/drop 0.2.10 → 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.cjs CHANGED
@@ -11817,7 +11817,9 @@ var formatFileSize = ship.formatFileSize;
11817
11817
  function createProcessedFile(file, options) {
11818
11818
  const webkitPath = file.webkitRelativePath || "";
11819
11819
  const path = options?.path || (webkitPath && webkitPath.trim() ? webkitPath : file.name);
11820
- const type = getMimeType(path);
11820
+ const mimeFromDb = getMimeType(path);
11821
+ const mimeFromBrowser = file.type;
11822
+ const type = mimeFromDb || mimeFromBrowser;
11821
11823
  return {
11822
11824
  // ProcessedFile properties
11823
11825
  // Note: md5 is intentionally undefined - Ship SDK will calculate it during deployment
@@ -11982,7 +11984,9 @@ function useDrop(options) {
11982
11984
  const processedFiles = cleanFiles.map((file) => createProcessedFile(file));
11983
11985
  const finalFiles = stripPrefix ? stripCommonPrefix(processedFiles) : processedFiles;
11984
11986
  const filesForValidation = finalFiles.map((f) => {
11985
- const isUnknownType = !f.file.type || f.file.type === "application/octet-stream";
11987
+ const browserUnknown = !f.file.type || f.file.type === "application/octet-stream";
11988
+ const mimeDbUnknown = !f.type || f.type === "application/octet-stream";
11989
+ const isUnknownType = browserUnknown && mimeDbUnknown;
11986
11990
  if (isUnknownType) {
11987
11991
  const textFile = new File([f.file], f.file.name, {
11988
11992
  type: "text/plain",
@@ -11995,13 +11999,14 @@ function useDrop(options) {
11995
11999
  configurable: true
11996
12000
  });
11997
12001
  }
11998
- return { ...f, file: textFile };
12002
+ return { ...f, file: textFile, type: "text/plain" };
11999
12003
  }
12000
12004
  return f;
12001
12005
  });
12002
12006
  const validatableFiles = filesForValidation.map((f) => ({
12003
12007
  name: f.file.name,
12004
- type: f.file.type,
12008
+ type: f.type,
12009
+ // Use corrected MIME type from mime-db, not browser's File.type
12005
12010
  size: f.file.size,
12006
12011
  status: f.status,
12007
12012
  statusMessage: f.statusMessage