Skip to content

Commit

Permalink
[se] Fix bug 69060
Browse files Browse the repository at this point in the history
  • Loading branch information
GoshaZotov committed Feb 6, 2025
1 parent f8d7be6 commit 7667f34
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 1 deletion.
2 changes: 1 addition & 1 deletion cell/model/FormulaObjects/parserFormula.js
Original file line number Diff line number Diff line change
Expand Up @@ -9960,7 +9960,7 @@ function parserFormula( formula, parent, _ws ) {

parserFormula.prototype.getFormulaHyperlink = function () {
for (var i = 0; i < this.outStack.length; i++) {
if (this.outStack[i] && this.outStack[i].name === "HYPERLINK") {
if (this.outStack[i] && (this.outStack[i].name === "HYPERLINK" || this.outStack[i].name === "IMPORTRANGE")) {
return true;
}
}
Expand Down
24 changes: 24 additions & 0 deletions cell/model/FormulaObjects/textanddataFunctions.js
Original file line number Diff line number Diff line change
Expand Up @@ -1245,6 +1245,27 @@ function (window, undefined) {
AscCommonExcel.importRangeLinksState.importRangeLinks[linkName].push(is3DRef);
}

let checkHyperlink = function (string) {
if (!string) {
return false;
}

// protocol check
let protocols = ['http://', 'https://', 'ftp://'];
let hasValidProtocol = false;

for (let i = 0; i < protocols.length; i++) {
if (string.indexOf(protocols[i]) === 0) {
hasValidProtocol = true;
break;
}
}

// domain check
let hasDomain = string.indexOf('.') !== -1 && string.charAt(0) !== '.';
return hasValidProtocol && hasDomain;
}

let api = window["Asc"]["editor"];
let wb = api && api.wbModel;
let eR = wb && wb.getExternalLinkByName(arg0.toString());
Expand Down Expand Up @@ -1273,6 +1294,9 @@ function (window, undefined) {
let externalCell = row.getCell(j);
if (externalCell) {
let cellValue = externalCell.getFormulaValue();
if (cellValue && cellValue.value && checkHyperlink(cellValue.value)) {
cellValue.hyperlink = cellValue.value;
}
ret.addElement(cellValue);
}
}
Expand Down

0 comments on commit 7667f34

Please sign in to comment.