Adding has protocol function and using that.

This commit is contained in:
mike12345567 2025-02-13 18:26:04 +00:00
parent e7f42a0075
commit 8ea25418b9
3 changed files with 6 additions and 1 deletions

View File

@ -247,3 +247,7 @@ export function hasCircularStructure(json: any) {
} }
return false return false
} }
export function urlHasProtocol(url: string): boolean {
return !!url.match(/^.+:\/\/.+$/)
}

View File

@ -159,6 +159,7 @@
"@types/tar": "6.1.5", "@types/tar": "6.1.5",
"@types/tmp": "0.2.6", "@types/tmp": "0.2.6",
"@types/uuid": "8.3.4", "@types/uuid": "8.3.4",
"@smithy/types": "4.0.0",
"chance": "^1.1.12", "chance": "^1.1.12",
"copyfiles": "2.4.1", "copyfiles": "2.4.1",
"docker-compose": "0.23.17", "docker-compose": "0.23.17",

View File

@ -340,7 +340,7 @@ export const getSignedUploadURL = async function (
} }
try { try {
let endpoint = datasource?.config?.endpoint let endpoint = datasource?.config?.endpoint
if (endpoint && !endpoint.startsWith("http")) { if (endpoint && !utils.urlHasProtocol(endpoint)) {
endpoint = `https://${endpoint}` endpoint = `https://${endpoint}`
} }
const s3 = new S3({ const s3 = new S3({