Skip to content

Commit

Permalink
fix(caa upload): accept dirty Amazon URL without trailing slash
Browse files Browse the repository at this point in the history
  • Loading branch information
kellnerd authored and ROpdebee committed Oct 19, 2021
1 parent 542dfc1 commit af5a998
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/mb_enhanced_cover_art_uploads/providers/amazon.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ export class AmazonProvider extends CoverArtProvider {
}

name = 'Amazon';
urlRegex = /\/(?:gp\/product|dp)\/([A-Za-z0-9]{10})(?:\/|$)/;
urlRegex = /\/(?:gp\/product|dp)\/([A-Za-z0-9]{10})(?:\/|\?|$)/;

async findImages(url: URL): Promise<CoverArt[]> {
const pageContent = await this.fetchPage(url);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ describe('amazon provider', () => {

const urlCases = [
['dirty URL', 'https://www.amazon.com/Pattern-Seeking-Animals/dp/B07RZ2T9F1/ref=tmm_acd_swatch_0?_encoding=UTF8&qid=&sr=', 'B07RZ2T9F1'],
['dirty URL without trailing slash', 'https://www.amazon.com/Chronicles-Narnia-Collectors-Radio-Theatre/dp/1624053661?qsid=145-0543367-7486236', '1624053661'],
['dp URL', 'https://www.amazon.com/dp/B07RZ2T9F1', 'B07RZ2T9F1'],
['gp URL', 'https://www.amazon.com/gp/product/B07RZ2T9F1', 'B07RZ2T9F1'],
];
Expand Down

0 comments on commit af5a998

Please sign in to comment.