Skip to content

Commit

Permalink
Merge pull request #1123 from Ontotext-AD/GDB-9092-Toast-messages-not…
Browse files Browse the repository at this point in the history
…-handling-<>&-symbols-when-stating-the-iri-is-invalid

GDB-9092 Toast messages not handling <>& symbols when stating the iri is invalid
  • Loading branch information
MartinaDimova authored Nov 8, 2023
2 parents 5d7828e + b2ef58f commit 6e4df2c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
9 changes: 5 additions & 4 deletions src/js/angular/autocomplete/controllers.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,9 +70,10 @@ function AutocompleteCtrl($scope, $interval, toastr, $repositories, $licenseServ

const addLabelConfig = function (label) {
$scope.setLoader(true, $translate.instant('autocomplete.update'));
const labelIriText = label.labelIri;
label.labelIri = UriUtils.expandPrefix(label.labelIri, $scope.namespaces);
if (UriUtils.isValidIri(label, label.labelIri) && label.labelIri !== "") {
let labelIriText = label.labelIri.toString();
labelIriText = UriUtils.expandPrefix(labelIriText, $scope.namespaces);
if (UriUtils.isValidIri(label, labelIriText) && labelIriText !== "") {
label.labelIri = labelIriText;
AutocompleteRestService.addLabelConfig(label)
.success(function () {
refreshLabelConfig();
Expand All @@ -83,7 +84,7 @@ function AutocompleteCtrl($scope, $interval, toastr, $repositories, $licenseServ
$scope.setLoader(false);
});
} else {
const errorMessage = decodeHTML($translate.instant('not.valid.iri', {value: labelIriText}));
const errorMessage = decodeHTML($translate.instant('not.valid.iri', {value: label.labelIri.toString()}));
toastr.error(errorMessage);
$scope.setLoader(false);
}
Expand Down
2 changes: 1 addition & 1 deletion src/js/angular/rdfrank/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,7 @@ rdfRankApp.controller('RDFRankCtrl', ['$scope', '$interval', 'toastr', '$reposit
_addToList(list, iriText);
} else {
refreshFilteringConfig();
const errorMessage = decodeHTML($translate.instant('not.valid.iri', {value: iriText}));
const errorMessage = decodeHTML($translate.instant('not.valid.iri', {value: iri.text.toString()}));
toastr.error(errorMessage);
}
};
Expand Down

0 comments on commit 6e4df2c

Please sign in to comment.