Skip to content

Commit dd0d22f

Browse files
committed
update dot url
1 parent bfc037a commit dd0d22f

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

src/index.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,9 @@ import md2markup from './md2markup.js';
1919

2020
function getUrlExtension(url) {
2121
let extension;
22-
if (url.split('.').length > 1) {
23-
extension = url.split(/[#?]/)[0].split('.').pop().trim();
22+
const lastSegment = url.split('/').pop() || '';
23+
if (lastSegment.split('.').length > 1) {
24+
extension = lastSegment.split(/[#?]/)[0].split('.').pop().trim();
2425
}
2526
return extension;
2627
}

0 commit comments

Comments
 (0)