fix: encode (#6464)

This commit is contained in:
chenos 2025-03-14 15:01:14 +08:00 committed by GitHub
parent 4269ff7412
commit cc524c45fe
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 9 additions and 1 deletions

View File

@ -205,6 +205,10 @@ function encodeFileURL(url: string): string {
return url; return url;
} }
if (url.includes('X-Amz-Content-Sha256')) {
return url;
}
const parts = url.split('/'); const parts = url.split('/');
const filename = parts.pop(); const filename = parts.pop();
parts.push(encodeURIComponent(filename)); parts.push(encodeURIComponent(filename));

View File

@ -9,10 +9,10 @@
import { isArr, isValid, toArr as toArray } from '@formily/shared'; import { isArr, isValid, toArr as toArray } from '@formily/shared';
import { UploadFile } from 'antd/es/upload/interface'; import { UploadFile } from 'antd/es/upload/interface';
import { useTranslation } from 'react-i18next';
import mime from 'mime'; import mime from 'mime';
import match from 'mime-match'; import match from 'mime-match';
import React, { useCallback } from 'react'; import React, { useCallback } from 'react';
import { useTranslation } from 'react-i18next';
import { useAPIClient } from '../../../api-client'; import { useAPIClient } from '../../../api-client';
import { UNKNOWN_FILE_ICON, UPLOAD_PLACEHOLDER } from './placeholder'; import { UNKNOWN_FILE_ICON, UPLOAD_PLACEHOLDER } from './placeholder';
import type { IUploadProps, UploadProps } from './type'; import type { IUploadProps, UploadProps } from './type';
@ -273,6 +273,10 @@ export function encodeFileURL(url: string): string {
return url; return url;
} }
if (url.includes('X-Amz-Content-Sha256')) {
return url;
}
const [base, search = ''] = url.split('?'); const [base, search = ''] = url.split('?');
const parts = base.split('/'); const parts = base.split('/');
const filename = parts.pop(); const filename = parts.pop();