Skip to content

Commit 6e9c50a

Browse files
committed
Fixed LGTM Checks
1 parent 8778de6 commit 6e9c50a

File tree

2 files changed

+11
-10
lines changed

2 files changed

+11
-10
lines changed

src/url/builder.ts

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -30,16 +30,19 @@ export const buildURL = (opts: UrlOptions & ImageKitOptions) => {
3030

3131
var urlObj, isSrcParameterUsedForURL, urlEndpointPattern;
3232

33-
if (opts.path) {
34-
urlEndpointPattern = new URL(opts.urlEndpoint).pathname;
35-
urlObj = new URL(pathJoin([opts.urlEndpoint.replace(urlEndpointPattern, ""), opts.path]));
36-
} else {
37-
urlObj = new URL(opts.src!);
38-
isSrcParameterUsedForURL = true;
33+
try {
34+
if (opts.path) {
35+
urlEndpointPattern = new URL(opts.urlEndpoint).pathname;
36+
urlObj = new URL(pathJoin([opts.urlEndpoint.replace(urlEndpointPattern, ""), opts.path]));
37+
} else {
38+
urlObj = new URL(opts.src!);
39+
isSrcParameterUsedForURL = true;
40+
}
41+
} catch(e) {
42+
console.error(e)
43+
return "";
3944
}
4045

41-
if (!urlObj) return "";
42-
4346
if (opts.sdkVersion && opts.sdkVersion.trim() != "") {
4447
urlObj.searchParams.append("ik-sdk-version", opts.sdkVersion.trim());
4548
}

src/utils/respond.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
import { UploadResponse } from "../interfaces";
2-
31
export default function(isError: boolean, response: any, callback?: (err: Error | null, response: any) => void) {
42
if(typeof callback == "function") {
53
if(isError) {

0 commit comments

Comments
 (0)