Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: Improve URL query parameter handling for correct concatenat… #1821

Closed
wants to merge 2 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 16 additions & 2 deletions packages/abc/lodop/lodop.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -86,10 +86,24 @@
if (!this._lodop) throw new Error(`请务必先调用 lodop 获取对象`);
}

private requestUrl(): string {
if (!this.cog.url) {
throw new Error('URL is not defined');
}
if (!this.cog.name) {
throw new Error('Name is not defined');
}
const urlObj = new URL(this.cog.url);
const params = new URLSearchParams(urlObj.search);
params.set('name', this.cog.name);
urlObj.search = params.toString();
return urlObj.toString();
}

private request(): void {
this.pending = true;

const url = `${this.cog.url}?name=${this.cog.name}`;
const url = this.requestUrl();
let checkMaxCount = this.cog.checkMaxCount as number;
const onResolve = (status: NzSafeAny, error?: NzSafeAny): void => {
this._init.next({
Expand Down Expand Up @@ -160,7 +174,7 @@
try {
const fakeFn = new Function(`return [${res[2]}]`);
arr = fakeFn();
} catch {}
} catch { }

Check failure on line 177 in packages/abc/lodop/lodop.service.ts

View workflow job for this annotation

GitHub Actions / lint

Delete `·`

Check failure on line 177 in packages/abc/lodop/lodop.service.ts

View workflow job for this annotation

GitHub Actions / lint

Delete `·`

if (arr != null && Array.isArray(arr) && contextObj) {
for (let i = 0; i < arr.length; i++) {
Expand Down
Loading