fix:修复kyc图片请求问题
This commit is contained in:
@@ -153,22 +153,20 @@ const parseFile = (path: string) => {
|
|||||||
// 移除末尾的斜杠
|
// 移除末尾的斜杠
|
||||||
baseUrl = baseUrl.replace(/\/+$/, '');
|
baseUrl = baseUrl.replace(/\/+$/, '');
|
||||||
|
|
||||||
// 如果 baseUrl 是完整的 URL,则提取主机名
|
// 从完整 URL 中提取域名部分
|
||||||
if (baseUrl.includes('://')) {
|
if (baseUrl.includes('://')) {
|
||||||
try {
|
try {
|
||||||
const parsedUrl = new URL(baseUrl);
|
const url = new URL(baseUrl);
|
||||||
baseUrl = parsedUrl.host;
|
baseUrl = url.host; // 这将获取域名和端口(如果有的话)
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error('无效的 URL:', error);
|
console.error('Invalid URL:', error);
|
||||||
return path; // URL 解析失败时返回原始路径
|
// 如果解析失败,使用原始值的域名部分
|
||||||
|
baseUrl = baseUrl.replace(/^https?:\/\//, '').split('/')[0];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 处理 baseUrl 可能只是主机名或 IP 的情况
|
// 构造最终的 URL
|
||||||
baseUrl = baseUrl.replace(/^https?:\/\//, '');
|
return `${path.startsWith('/') ? path : '/' + path}`;
|
||||||
|
|
||||||
// 构造最终的 URL,确保格式正确
|
|
||||||
return `//${baseUrl}/file${path.startsWith('/') ? path : '/' + path}`;
|
|
||||||
}
|
}
|
||||||
const getStatusText = (status: string) => {
|
const getStatusText = (status: string) => {
|
||||||
switch (status) {
|
switch (status) {
|
||||||
|
|||||||
Reference in New Issue
Block a user