新增用户意图确认功能
This commit is contained in:
1 parent
cf2e4bdd9c
commit
b8926f00d7
574 files changed
+97664
-97208
No files matched your search
@@ -1,34 +1,34 @@
|
||||
const MACOS_APP_BUNDLE_CONTENT_TYPES = new Set([
|
||||
"",
|
||||
"application/octet-stream",
|
||||
]);
|
||||
|
||||
export const MACOS_APP_BUNDLE_UPLOAD_MESSAGE =
|
||||
"macOS .app bundles can't be uploaded directly from the browser. Compress the app as a .zip or upload the .dmg instead.";
|
||||
|
||||
export function isLikelyMacOSAppBundle(file: Pick<File, "name" | "type">) {
|
||||
return (
|
||||
file.name.toLowerCase().endsWith(".app") &&
|
||||
MACOS_APP_BUNDLE_CONTENT_TYPES.has(file.type)
|
||||
);
|
||||
}
|
||||
|
||||
export function splitUnsupportedUploadFiles(fileList: File[] | FileList) {
|
||||
const incoming = Array.from(fileList);
|
||||
const accepted: File[] = [];
|
||||
const rejected: File[] = [];
|
||||
|
||||
for (const file of incoming) {
|
||||
if (isLikelyMacOSAppBundle(file)) {
|
||||
rejected.push(file);
|
||||
continue;
|
||||
}
|
||||
accepted.push(file);
|
||||
}
|
||||
|
||||
return {
|
||||
accepted,
|
||||
rejected,
|
||||
message: rejected.length > 0 ? MACOS_APP_BUNDLE_UPLOAD_MESSAGE : undefined,
|
||||
};
|
||||
}
|
||||
const MACOS_APP_BUNDLE_CONTENT_TYPES = new Set([
|
||||
"",
|
||||
"application/octet-stream",
|
||||
]);
|
||||
|
||||
export const MACOS_APP_BUNDLE_UPLOAD_MESSAGE =
|
||||
"macOS .app bundles can't be uploaded directly from the browser. Compress the app as a .zip or upload the .dmg instead.";
|
||||
|
||||
export function isLikelyMacOSAppBundle(file: Pick<File, "name" | "type">) {
|
||||
return (
|
||||
file.name.toLowerCase().endsWith(".app") &&
|
||||
MACOS_APP_BUNDLE_CONTENT_TYPES.has(file.type)
|
||||
);
|
||||
}
|
||||
|
||||
export function splitUnsupportedUploadFiles(fileList: File[] | FileList) {
|
||||
const incoming = Array.from(fileList);
|
||||
const accepted: File[] = [];
|
||||
const rejected: File[] = [];
|
||||
|
||||
for (const file of incoming) {
|
||||
if (isLikelyMacOSAppBundle(file)) {
|
||||
rejected.push(file);
|
||||
continue;
|
||||
}
|
||||
accepted.push(file);
|
||||
}
|
||||
|
||||
return {
|
||||
accepted,
|
||||
rejected,
|
||||
message: rejected.length > 0 ? MACOS_APP_BUNDLE_UPLOAD_MESSAGE : undefined,
|
||||
};
|
||||
}
|
||||
Reference in new issue
Block a user