diff --git a/changelog/items/bugs-fixed/undefined-dir-upload-name-and-empty-progress.md b/changelog/items/bugs-fixed/undefined-dir-upload-name-and-empty-progress.md new file mode 100644 index 00000000..a6112e27 --- /dev/null +++ b/changelog/items/bugs-fixed/undefined-dir-upload-name-and-empty-progress.md @@ -0,0 +1,2 @@ +- fixed uploaded directory name (was "undefined" before) +- fixed empty directory upload progress (size was not calculated for directories) diff --git a/packages/website/package.json b/packages/website/package.json index 2d50ab99..3fbb8da4 100644 --- a/packages/website/package.json +++ b/packages/website/package.json @@ -25,7 +25,7 @@ "gatsby-plugin-postcss": "^4.14.0", "gatsby-plugin-purgecss": "^6.1.0", "gatsby-plugin-react-helmet": "^4.14.0", - "gatsby-plugin-robots-txt": "^1.6.13", + "gatsby-plugin-robots-txt": "^1.6.14", "gatsby-plugin-sharp": "^4.0.1", "gatsby-plugin-svgr": "^3.0.0-beta.0", "gatsby-remark-classes": "^1.0.2", diff --git a/packages/website/src/components/Uploader/Uploader.js b/packages/website/src/components/Uploader/Uploader.js index f5241f42..cdb86e15 100644 --- a/packages/website/src/components/Uploader/Uploader.js +++ b/packages/website/src/components/Uploader/Uploader.js @@ -47,8 +47,9 @@ const Uploader = () => { const handleDrop = async (files) => { if (mode === "directory" && files.length) { const name = getRootDirectory(files[0]); // get the file path from the first file + const size = files.reduce((acc, file) => acc + file.size, 0); - files = [{ name, files }]; + files = [{ name, size, files }]; } setUploads((uploads) => [...files.map((file) => ({ id: nanoid(), file, mode, status: "enqueued" })), ...uploads]); diff --git a/packages/website/src/components/Uploader/UploaderElement.js b/packages/website/src/components/Uploader/UploaderElement.js index 86dd2ada..70557b63 100644 --- a/packages/website/src/components/Uploader/UploaderElement.js +++ b/packages/website/src/components/Uploader/UploaderElement.js @@ -85,7 +85,7 @@ export default function UploaderElement({ onUploadStateChange, upload }) { if (upload.mode === "directory") { const files = upload.file.files; const directory = files.reduce((acc, file) => ({ ...acc, [getRelativeFilePath(file)]: file }), {}); - const name = encodeURIComponent(upload.name); + const name = encodeURIComponent(upload.file.name); response = await client.uploadDirectory(directory, name, { onUploadProgress }); } else { diff --git a/packages/website/yarn.lock b/packages/website/yarn.lock index 5874db1a..88c98c3d 100644 --- a/packages/website/yarn.lock +++ b/packages/website/yarn.lock @@ -6175,12 +6175,12 @@ gatsby-plugin-react-helmet@^4.14.0: dependencies: "@babel/runtime" "^7.15.4" -gatsby-plugin-robots-txt@^1.6.13: - version "1.6.13" - resolved "https://registry.yarnpkg.com/gatsby-plugin-robots-txt/-/gatsby-plugin-robots-txt-1.6.13.tgz#01e1ce68e3f4e07f957ac9a20cd2a9e12fdd3f79" - integrity sha512-MUPJsvkALwSmfRb1L3IVNmzIqwV35fol1RVot425ZYXvtD+s0OtZli5VnhLNxsX0beodyavzFl0SRJCCQZz0/g== +gatsby-plugin-robots-txt@^1.6.14: + version "1.6.14" + resolved "https://registry.yarnpkg.com/gatsby-plugin-robots-txt/-/gatsby-plugin-robots-txt-1.6.14.tgz#e7ce50b137fecc81c1ac384ddc544a4bafd8da89" + integrity sha512-5NLdgKPw7xHjvowNDU5aWzl/g3M3WU0Equn73aXGGdEue9Nuq7zh/Lh3oX+OM+MZolRCiM9GNHxdIvYPDWNXgA== dependencies: - "@babel/runtime" "^7.14.0" + "@babel/runtime" "^7.15.4" generate-robotstxt "^8.0.3" gatsby-plugin-sharp@^4.0.1: