-
Notifications
You must be signed in to change notification settings - Fork 107
fix(EdgedriverBinary): generate per-platform URLs, drop dead listing API #1026
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
Changes from 1 commit
13c0688
34a47e1
4bc09a9
d5a948b
90ef54b
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -1,10 +1,28 @@ | ||||||||||||||
| import path from 'node:path'; | ||||||||||||||
|
|
||||||||||||||
| import { SingletonProto } from 'egg'; | ||||||||||||||
|
|
||||||||||||||
| import { BinaryType } from '../../enum/Binary.ts'; | ||||||||||||||
| import { AbstractBinary, BinaryAdapter, type BinaryItem, type FetchResult } from './AbstractBinary.ts'; | ||||||||||||||
|
|
||||||||||||||
| // Microsoft moved the Edge WebDriver download listing off the public | ||||||||||||||
| // Azure Blob container (the old XML listing API returns | ||||||||||||||
| // `PublicAccessNotPermitted` since ~2026-04-07). The new source of truth | ||||||||||||||
| // is a single JSON dump at https://msedgedriver.microsoft.com/listing.json | ||||||||||||||
| // which lists every version-prefixed driver file; individual files are | ||||||||||||||
| // downloadable from https://msedgedriver.microsoft.com/<name>. | ||||||||||||||
| const EDGEDRIVER_LISTING_URL = 'https://msedgedriver.microsoft.com/listing.json'; | ||||||||||||||
| const EDGEDRIVER_DOWNLOAD_BASE = 'https://msedgedriver.microsoft.com/'; | ||||||||||||||
|
|
||||||||||||||
| interface EdgedriverListingEntry { | ||||||||||||||
| isDirectory: boolean; | ||||||||||||||
| name: string; | ||||||||||||||
| contentLength: number; | ||||||||||||||
| lastModified: string; | ||||||||||||||
| } | ||||||||||||||
| interface EdgedriverListing { | ||||||||||||||
| items: EdgedriverListingEntry[]; | ||||||||||||||
| generatedAt: string; | ||||||||||||||
| } | ||||||||||||||
|
|
||||||||||||||
| @SingletonProto() | ||||||||||||||
| @BinaryAdapter(BinaryType.Edgedriver) | ||||||||||||||
| export class EdgedriverBinary extends AbstractBinary { | ||||||||||||||
|
|
@@ -169,51 +187,47 @@ export class EdgedriverBinary extends AbstractBinary { | |||||||||||||
| } | ||||||||||||||
|
|
||||||||||||||
| // fetch sub dir | ||||||||||||||
| // /foo/ => foo/ | ||||||||||||||
| // /126.0.2578.0/ => 126.0.2578.0/ | ||||||||||||||
| const subDir = dir.slice(1); | ||||||||||||||
| // https://msedgewebdriverstorage.blob.core.windows.net/edgewebdriver?prefix=124.0.2478.97/&delimiter=/&maxresults=100&restype=container&comp=list | ||||||||||||||
| const url = `https://msedgewebdriverstorage.blob.core.windows.net/edgewebdriver?prefix=${encodeURIComponent(subDir)}&delimiter=/&maxresults=100&restype=container&comp=list`; | ||||||||||||||
| const xml = await this.requestXml(url); | ||||||||||||||
| return { items: this.#parseItems(xml), nextParams: null }; | ||||||||||||||
| } | ||||||||||||||
|
|
||||||||||||||
| #parseItems(xml: string): BinaryItem[] { | ||||||||||||||
| const listing = await this.#fetchListing(); | ||||||||||||||
elrrrrrrr marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||||||||||||||
| if (!listing) { | ||||||||||||||
| return { items: [], nextParams: null }; | ||||||||||||||
| } | ||||||||||||||
|
||||||||||||||
| if (!listing) { | |
| return { items: [], nextParams: null }; | |
| } | |
| if (!listing?.items) { | |
| return; | |
| } |
References
- Ensure that parsing of query parameters gracefully handles invalid inputs (e.g., non-numeric values) by providing sensible fallbacks or defaults, rather than causing unexpected behavior.
elrrrrrrr marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
coderabbitai[bot] marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
elrrrrrrr marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
elrrrrrrr marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,35 @@ | ||
| { | ||
| "items": [ | ||
| { | ||
| "isDirectory": false, | ||
| "name": "126.0.2578.0/edgedriver_arm64.zip", | ||
| "contentLength": 9085682, | ||
| "lastModified": "2024-05-10T17:03:37+00:00" | ||
| }, | ||
| { | ||
| "isDirectory": false, | ||
| "name": "126.0.2578.0/edgedriver_mac64.zip", | ||
| "contentLength": 10907611, | ||
| "lastModified": "2024-05-10T16:37:33+00:00" | ||
| }, | ||
| { | ||
| "isDirectory": false, | ||
| "name": "126.0.2578.0/edgedriver_mac64_m1.zip", | ||
| "contentLength": 10090619, | ||
| "lastModified": "2024-05-10T16:37:33+00:00" | ||
| }, | ||
| { | ||
| "isDirectory": false, | ||
| "name": "126.0.2578.0/edgedriver_win32.zip", | ||
| "contentLength": 8759537, | ||
| "lastModified": "2024-05-10T17:04:29+00:00" | ||
| }, | ||
| { | ||
| "isDirectory": false, | ||
| "name": "126.0.2578.0/edgedriver_win64.zip", | ||
| "contentLength": 9564395, | ||
| "lastModified": "2024-05-10T17:04:10+00:00" | ||
| } | ||
| ], | ||
| "generatedAt": "2026-04-08T13:18:30.7241345+00:00" | ||
| } |
Uh oh!
There was an error while loading. Please reload this page.