Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed message not displaying in Web UI when id includes '#' symbol #180

Merged
merged 1 commit into from
Jun 3, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion src/Papercut.App.WebApi/assets/js/controllers.js
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ papercutApp.controller('MailCtrl', function ($scope, $http, $sce, $timeout, $int
} else {
$scope.preview = message;
var e = startEvent("Loading message", message.Id, "glyphicon-download-alt");
$http.get('api/messages/' + message.Id).then(function (resp) {
$http.get('api/messages/' + $scope.escapeUrl(message.Id)).then(function (resp) {
$scope.cache[message.Id] = resp.data;

resp.data.previewHTML = $sce.trustAsHtml(resp.data.HtmlBody);
Expand Down Expand Up @@ -163,6 +163,9 @@ papercutApp.controller('MailCtrl', function ($scope, $http, $sce, $timeout, $int
return (new Date(timestamp)).toString();
};

$scope.escapeUrl = function (messageId) {
return messageId.replace("#", "%23");
}

function startEvent(name, args, glyphicon) {
var eID = guid();
Expand Down