Parcourir la source

added another fallback in the title is empty

Gildas il y a 7 ans
Parent
commit
b5f3d16567
1 fichiers modifiés avec 2 ajouts et 1 suppressions
  1. 2 1
      lib/single-file/single-file-core.js

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

@@ -258,8 +258,9 @@ this.SingleFileCore = this.SingleFileCore || (() => {
 			if (titleElement) {
 				title = titleElement.textContent.trim();
 			}
+			const matchTitle = this.baseURI.match(/([^/]*)\/?(\.html?.*)$/) || this.baseURI.match(/\/\/([^/]*)\/?$/);
 			return {
-				title: title || (this.baseURI ? this.baseURI.match(/([^/]*)\/?(\.html?.*)$/)[1] : ""),
+				title: title || (this.baseURI && matchTitle ? matchTitle[1] : ""),
 				content: this.dom.serialize()
 			};
 		}