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