@gradio/upload 0.6.0 → 0.6.1

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/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # @gradio/upload
2
2
 
3
+ ## 0.6.1
4
+
5
+ ### Fixes
6
+
7
+ - [#6982](https://github.com/gradio-app/gradio/pull/6982) [`3f139c7`](https://github.com/gradio-app/gradio/commit/3f139c7c995f749562bb007d2a567bb167669de9) - Fix File drag and drop for specific file_types. Thanks [@dawoodkhan82](https://github.com/dawoodkhan82)!
8
+
3
9
  ## 0.6.0
4
10
 
5
11
  ### Features
package/package.json CHANGED
@@ -1,15 +1,15 @@
1
1
  {
2
2
  "name": "@gradio/upload",
3
- "version": "0.6.0",
3
+ "version": "0.6.1",
4
4
  "description": "Gradio UI packages",
5
5
  "type": "module",
6
6
  "main": "src/index.ts",
7
7
  "author": "",
8
8
  "license": "ISC",
9
9
  "dependencies": {
10
+ "@gradio/client": "^0.10.1",
10
11
  "@gradio/atoms": "^0.4.1",
11
- "@gradio/upload": "^0.6.0",
12
- "@gradio/client": "^0.10.0",
12
+ "@gradio/upload": "^0.6.1",
13
13
  "@gradio/utils": "^0.2.0",
14
14
  "@gradio/icons": "^0.3.2"
15
15
  },
package/src/Upload.svelte CHANGED
@@ -129,11 +129,16 @@
129
129
  async function loadFilesFromDrop(e: DragEvent): Promise<void> {
130
130
  dragging = false;
131
131
  if (!e.dataTransfer?.files) return;
132
-
133
- const files_to_load = Array.from(e.dataTransfer.files).filter((f) => {
134
- const file_extension =
135
- f.type !== "" ? f.type : "." + f.name.split(".").pop();
136
- if (file_extension && is_valid_mimetype(filetype, file_extension)) {
132
+ const files_to_load = Array.from(e.dataTransfer.files).filter((file) => {
133
+ const file_extension = "." + file.name.split(".").pop();
134
+ if (file.type && is_valid_mimetype(filetype, file.type)) {
135
+ return true;
136
+ }
137
+ if (
138
+ file_extension && Array.isArray(filetype)
139
+ ? filetype.includes(file_extension)
140
+ : file_extension === filetype
141
+ ) {
137
142
  return true;
138
143
  }
139
144
  dispatch("error", `Invalid file type only ${filetype} allowed.`);
@@ -182,6 +187,7 @@
182
187
  <slot />
183
188
  <input
184
189
  aria-label="file upload"
190
+ data-testid="file-upload"
185
191
  type="file"
186
192
  bind:this={hidden_upload}
187
193
  on:change={load_files_from_upload}