@gradio/upload 0.7.5 → 0.7.7
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 +14 -0
- package/package.json +6 -6
- package/src/Upload.svelte +9 -3
package/CHANGELOG.md
CHANGED
@@ -1,5 +1,19 @@
|
|
1
1
|
# @gradio/upload
|
2
2
|
|
3
|
+
## 0.7.7
|
4
|
+
|
5
|
+
### Dependency updates
|
6
|
+
|
7
|
+
- @gradio/upload@0.7.7
|
8
|
+
- @gradio/client@0.13.0
|
9
|
+
- @gradio/wasm@0.8.0
|
10
|
+
|
11
|
+
## 0.7.6
|
12
|
+
|
13
|
+
### Features
|
14
|
+
|
15
|
+
- [#7625](https://github.com/gradio-app/gradio/pull/7625) [`8181695`](https://github.com/gradio-app/gradio/commit/8181695e70187e8bc2bf7518697098c8d1b9843d) - image upload fix. Thanks [@dawoodkhan82](https://github.com/dawoodkhan82)!
|
16
|
+
|
3
17
|
## 0.7.5
|
4
18
|
|
5
19
|
### Fixes
|
package/package.json
CHANGED
@@ -1,18 +1,18 @@
|
|
1
1
|
{
|
2
2
|
"name": "@gradio/upload",
|
3
|
-
"version": "0.7.
|
3
|
+
"version": "0.7.7",
|
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/atoms": "^0.5.3",
|
11
|
-
"@gradio/client": "^0.12.2",
|
12
|
-
"@gradio/upload": "^0.7.5",
|
13
10
|
"@gradio/icons": "^0.3.3",
|
14
|
-
"@gradio/
|
15
|
-
"@gradio/utils": "^0.3.0"
|
11
|
+
"@gradio/client": "^0.13.0",
|
12
|
+
"@gradio/utils": "^0.3.0",
|
13
|
+
"@gradio/atoms": "^0.5.3",
|
14
|
+
"@gradio/wasm": "^0.8.0",
|
15
|
+
"@gradio/upload": "^0.7.7"
|
16
16
|
},
|
17
17
|
"main_changeset": true,
|
18
18
|
"exports": {
|
package/src/Upload.svelte
CHANGED
@@ -28,7 +28,7 @@
|
|
28
28
|
const dispatch = createEventDispatcher();
|
29
29
|
const validFileTypes = ["image", "video", "audio", "text", "file"];
|
30
30
|
const processFileType = (type: string): string => {
|
31
|
-
if (type.startsWith(".")) {
|
31
|
+
if (type.startsWith(".") || type.endsWith("/*")) {
|
32
32
|
return type;
|
33
33
|
}
|
34
34
|
if (validFileTypes.includes(type)) {
|
@@ -116,7 +116,13 @@
|
|
116
116
|
uploaded_file_extension: string,
|
117
117
|
uploaded_file_type: string
|
118
118
|
): boolean {
|
119
|
-
if (
|
119
|
+
if (
|
120
|
+
!file_accept ||
|
121
|
+
file_accept === "*" ||
|
122
|
+
file_accept === "file/*" ||
|
123
|
+
(Array.isArray(file_accept) &&
|
124
|
+
file_accept.some((accept) => accept === "*" || accept === "file/*"))
|
125
|
+
) {
|
120
126
|
return true;
|
121
127
|
}
|
122
128
|
let acceptArray: string[];
|
@@ -145,7 +151,7 @@
|
|
145
151
|
const file_extension = "." + file.name.split(".").pop();
|
146
152
|
if (
|
147
153
|
file_extension &&
|
148
|
-
is_valid_mimetype(
|
154
|
+
is_valid_mimetype(accept_file_types, file_extension, file.type)
|
149
155
|
) {
|
150
156
|
return true;
|
151
157
|
}
|