Просмотр исходного кода

Fixed issues with formatting of last segment (cf. issue #131)

Gildas 7 лет назад
Родитель
Сommit
23655d1066
1 измененных файлов с 6 добавлено и 2 удалено
  1. 6 2
      lib/single-file/single-file-core.js

+ 6 - 2
lib/single-file/single-file-core.js

@@ -1566,13 +1566,17 @@ this.SingleFileCore = this.SingleFileCore || (() => {
 				lastSegment = lastSegmentMatch && lastSegmentMatch[0];
 			}
 			if (!lastSegment) {
-				lastSegmentMatch = lastSegment.match(/(.*)<\.[^.]+$/);
+				lastSegmentMatch = lastSegment.match(/(.*)\.[^.]+$/);
 				lastSegment = lastSegmentMatch && lastSegmentMatch[0];
 			}
 			if (!lastSegment) {
 				lastSegment = url.hostname.replace(/\/+/g, "_").replace(/\/$/, "");
 			}
-			lastSegment.replace(/\/$/, "").replace(/^\//, "");
+			lastSegmentMatch = lastSegment.match(/(.*)\.[^.]+$/);
+			if (lastSegmentMatch && lastSegmentMatch[1]) {
+				lastSegment = lastSegmentMatch[1];
+			}
+			lastSegment = lastSegment.replace(/\/$/, "").replace(/^\//, "");
 			return lastSegment;
 		}