mirror of
https://github.com/labring/FastGPT.git
synced 2025-10-14 15:11:13 +00:00
perf: read file internal (#5282)
This commit is contained in:
@@ -27,6 +27,7 @@ import type { StoreSecretValueType } from '@fastgpt/global/common/secret/type';
|
||||
import { addLog } from '../../../../common/system/log';
|
||||
import { SERVICE_LOCAL_HOST } from '../../../../common/system/tools';
|
||||
import { formatHttpError } from '../utils';
|
||||
import { isInternalAddress } from '../../../../common/system/utils';
|
||||
|
||||
type PropsArrType = {
|
||||
key: string;
|
||||
@@ -414,6 +415,10 @@ async function fetchData({
|
||||
params: Record<string, any>;
|
||||
timeout: number;
|
||||
}) {
|
||||
if (isInternalAddress(url)) {
|
||||
return Promise.reject('Url is invalid');
|
||||
}
|
||||
|
||||
const { data: response } = await axios({
|
||||
method,
|
||||
baseURL: `http://${SERVICE_LOCAL_HOST}`,
|
||||
|
@@ -15,6 +15,7 @@ import { addLog } from '../../../../common/system/log';
|
||||
import { addRawTextBuffer, getRawTextBuffer } from '../../../../common/buffer/rawText/controller';
|
||||
import { addMinutes } from 'date-fns';
|
||||
import { getNodeErrResponse } from '../utils';
|
||||
import { isInternalAddress } from '../../../../common/system/utils';
|
||||
|
||||
type Props = ModuleDispatchProps<{
|
||||
[NodeInputKeyEnum.fileUrlList]: string[];
|
||||
@@ -175,6 +176,9 @@ export const getFileContentFromLinks = async ({
|
||||
}
|
||||
|
||||
try {
|
||||
if (isInternalAddress(url)) {
|
||||
return Promise.reject('Url is invalid');
|
||||
}
|
||||
// Get file buffer data
|
||||
const response = await axios.get(url, {
|
||||
baseURL: serverRequestBaseUrl,
|
||||
|
Reference in New Issue
Block a user