Hopefully fix encoding issues

This commit is contained in:
Laura Hausmann 2023-04-13 15:28:22 +02:00
parent 65ab7f2941
commit c3c220753f
Signed by: zotan
GPG key ID: D044E84C5BE01605
2 changed files with 8 additions and 8 deletions

View file

@ -74,19 +74,19 @@ else {
} }
function copy_hash_np() { function copy_hash_np() {
copyToClipboard('[#np](@Log.NowPlayingUrl) @Model.CopyArtist - @Model.CopyAlbum'); copyToClipboard('[#np](@Html.Raw(Log.NowPlayingUrl)) @Html.Raw(Model.CopyArtist) - @Html.Raw(Model.CopyAlbum)');
reset_copy_labels(); reset_copy_labels();
document.getElementById('copy_hash_np').innerText = 'Copy #np (Copied!)'; document.getElementById('copy_hash_np').innerText = 'Copy #np (Copied!)';
} }
function copy_journal_full() { function copy_journal_full() {
copyToClipboard('[@Model.CopyArtist](' + getUrl('@Model.LogArtist') + ') - [@Model.CopyAlbum](' + getUrl('@Model.LogArtist', '@Model.LogAlbum') + ')') copyToClipboard('[@Html.Raw(Model.CopyArtist)](' + getUrl('@Html.Raw(Model.LogArtist)') + ') - [@Html.Raw(Model.CopyAlbum)](' + getUrl('@Html.Raw(Model.LogArtist)', '@Html.Raw(Model.LogAlbum)') + ')')
reset_copy_labels(); reset_copy_labels();
document.getElementById('copy_journal_full').innerText = 'Copy journal (full) (Copied!)'; document.getElementById('copy_journal_full').innerText = 'Copy journal (full) (Copied!)';
} }
function copy_journal_album() { function copy_journal_album() {
copyToClipboard(', [@Model.CopyAlbum](' + getUrl('@Model.LogArtist', '@Model.LogAlbum') + ')') copyToClipboard(', [@Html.Raw(Model.CopyAlbum)](' + getUrl('@Html.Raw(Model.LogArtist)', '@Html.Raw(Model.LogAlbum)') + ')')
reset_copy_labels(); reset_copy_labels();
document.getElementById('copy_journal_album').innerText = 'Copy journal (album only) (Copied!)'; document.getElementById('copy_journal_album').innerText = 'Copy journal (album only) (Copied!)';
} }

View file

@ -52,11 +52,11 @@ namespace webmusic.Pages {
if (Log.StatisticsEnabled && Request.Headers["Remote-User"].Equals(Log.StatisticsUser) && Files.Any()) { if (Log.StatisticsEnabled && Request.Headers["Remote-User"].Equals(Log.StatisticsUser) && Files.Any()) {
var pathparts = Displaypath.Split(System.IO.Path.DirectorySeparatorChar); var pathparts = Displaypath.Split(System.IO.Path.DirectorySeparatorChar);
if (pathparts.Length > 2) { if (pathparts.Length > 2) {
CopyAlbum = pathparts[Index.FromEnd(1)]; CopyAlbum = pathparts[Index.FromEnd(1)].Replace("'", "\\'");
CopyArtist = pathparts[Index.FromEnd(2)]; CopyArtist = pathparts[Index.FromEnd(2)].Replace("'", "\\'");;
LogAlbum = HttpUtility.UrlPathEncode(pathparts[Index.FromEnd(1)]); LogAlbum = HttpUtility.UrlPathEncode(pathparts[Index.FromEnd(1)]).Replace("'", "\\'");;
LogArtist = HttpUtility.UrlPathEncode(pathparts[Index.FromEnd(2)]); LogArtist = HttpUtility.UrlPathEncode(pathparts[Index.FromEnd(2)]).Replace("'", "\\'");;
LogUrl = Request.GetEncodedUrl(); LogUrl = Request.GetEncodedUrl().Replace("'", "\\'");;
LogConditionsMet = true; LogConditionsMet = true;
} }
} }