File tree Expand file tree Collapse file tree 2 files changed +5
-5
lines changed
packages/service/common/system
projects/app/src/pages/api/core/dataset/collection/create Expand file tree Collapse file tree 2 files changed +5
-5
lines changed Original file line number Diff line number Diff line change @@ -30,10 +30,10 @@ export const isInternalAddress = (url: string): boolean => {
3030 return true ;
3131 }
3232
33- // For non-metadata URLs , check if it's a domain name
33+ // For IP addresses , check if they are internal
3434 const ipv4Pattern = / ^ ( \d { 1 , 3 } \. ) { 3 } \d { 1 , 3 } $ / ;
3535 if ( ! ipv4Pattern . test ( hostname ) ) {
36- return true ;
36+ return false ; // Not an IP address, so it's a domain name - consider it external by default
3737 }
3838
3939 // ... existing IP validation code ...
Original file line number Diff line number Diff line change @@ -29,16 +29,16 @@ async function handler(req: NextApiRequest): CreateCollectionResponse {
2929 } ) ;
3030 const { title = link , content = '' } = result [ 0 ] ;
3131
32- if ( ! content ) {
33- return Promise . reject ( 'Can not fetch content from link' ) ;
32+ if ( ! content || content === 'Cannot fetch internal url' ) {
33+ return Promise . reject ( content || 'Can not fetch content from link' ) ;
3434 }
3535
3636 const { collectionId, insertResults } = await createCollectionAndInsertData ( {
3737 dataset,
3838 rawText : content ,
3939 createCollectionParams : {
4040 ...body ,
41- name : title ,
41+ name : title || link ,
4242 teamId,
4343 tmbId,
4444 type : DatasetCollectionTypeEnum . link ,
You can’t perform that action at this time.
0 commit comments