Skip to content

Commit 0b5a738

Browse files
committed
Add hash warning
1 parent 401f267 commit 0b5a738

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

src/containers/transform/TransformContainer.ts

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -482,11 +482,16 @@ export class TransformContainer extends Container {
482482
newContent = newContent.replace(/(gdoc:[A-Z0-9_-]+)(#[^'")\s]*)?/ig, (str: string) => {
483483
let fileId = str.substring('gdoc:'.length).replace(/#.*/, '');
484484
let hash = getUrlHash(str) || '';
485-
if (hash && this.globalHeadersMap[str]) {
486-
const idx = this.globalHeadersMap[str].indexOf('#');
487-
if (idx >= 0) {
488-
fileId = this.globalHeadersMap[str].substring('gdoc:'.length, idx);
489-
hash = this.globalHeadersMap[str].substring(idx);
485+
if (hash) {
486+
if (this.globalHeadersMap[str]) {
487+
const idx = this.globalHeadersMap[str].indexOf('#');
488+
if (idx >= 0) {
489+
fileId = this.globalHeadersMap[str].substring('gdoc:'.length, idx);
490+
hash = this.globalHeadersMap[str].substring(idx);
491+
}
492+
} else {
493+
const fullLink = str;
494+
this.logger.warn(`In ${fileName} there is a link to ${fullLink} which can't be translated into bookmark link`);
490495
}
491496
}
492497
const lastLog = this.localLog.findLastFile(fileId);

0 commit comments

Comments
 (0)