Skip to content

Commit

Permalink
GDB-9092 Toast messages not handling <> and symbols when stating the …
Browse files Browse the repository at this point in the history
…iri is invalid

* Using function decodeHTML() to decode HTML entities (e.g., &lt;, &gt;, &amp;) in a given HTML string back into their corresponding characters. It utilizes the HTML textarea element to perform this decoding.
  • Loading branch information
martina.dimova committed Nov 7, 2023
1 parent a0f140c commit fa269d9
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 3 additions & 1 deletion src/js/angular/autocomplete/controllers.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import 'angular/rest/autocomplete.rest.service';
import {mapNamespacesResponse} from "../rest/mappers/namespaces-mapper";
import {decodeHTML} from "../../../app";

const modules = [
'toastr',
Expand Down Expand Up @@ -82,7 +83,8 @@ function AutocompleteCtrl($scope, $interval, toastr, $repositories, $licenseServ
$scope.setLoader(false);
});
} else {
toastr.error($translate.instant('not.valid.iri', {value: labelIriText}));
const errorMessage = decodeHTML($translate.instant('not.valid.iri', {value: labelIriText}));
toastr.error(errorMessage);
$scope.setLoader(false);
}
};
Expand Down
4 changes: 3 additions & 1 deletion src/js/angular/rdfrank/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import 'angular/utils/uri-utils';
import 'angular/rest/rdfrank.rest.service';
import 'ng-tags-input/build/ng-tags-input.min';
import {mapNamespacesResponse} from "../rest/mappers/namespaces-mapper";
import {decodeHTML} from "../../../app";

const rdfRankApp = angular.module('graphdb.framework.rdfrank', [
'ngRoute',
Expand Down Expand Up @@ -249,7 +250,8 @@ rdfRankApp.controller('RDFRankCtrl', ['$scope', '$interval', 'toastr', '$reposit
_addToList(list, iriText);
} else {
refreshFilteringConfig();
toastr.error($translate.instant('not.valid.iri', {value: iri.text}));
const errorMessage = decodeHTML($translate.instant('not.valid.iri', {value: iriText}));
toastr.error(errorMessage);
}
};

Expand Down

0 comments on commit fa269d9

Please sign in to comment.