Change returnurl from abosuleurl to relaviveurl (#8265)

This commit is contained in:
LorenzoFrediani-Laser
2019-08-15 21:17:19 +02:00
committed by Sébastien Ros
parent dce04a2587
commit 6c7390a073
24 changed files with 35 additions and 35 deletions

View File

@@ -3,7 +3,7 @@
@using Orchard.Utility.Extensions;
@{
ContentItem contentItem = Model.ContentItem;
var returnUrl = ViewContext.RequestContext.HttpContext.Request.ToUrlString();
var returnUrl = ViewContext.RequestContext.HttpContext.Request.RawUrl;
}
<div class="summary" itemscope="itemscope" itemid="@contentItem.Id" itemtype="http://orchardproject.net/data/ContentItem">
<div class="properties">

View File

@@ -5,6 +5,6 @@
ContentPart contentPart = Model.ContentPart;
}
@if (Authorizer.Authorize(Permissions.CreateContent, contentPart)) {
<a href="@Url.Action("Clone", "Admin", new { Id = Model.ContentItem.Id, ReturnUrl = Request.ToUrlString(), Area = "Contents" })" itemprop="UnsafeUrl">@T("Clone")</a>
<a href="@Url.Action("Clone", "Admin", new { Id = Model.ContentItem.Id, ReturnUrl = Request.RawUrl, Area = "Contents" })" itemprop="UnsafeUrl">@T("Clone")</a>
@T(" | ")
}

View File

@@ -12,7 +12,7 @@
if (contentPart.HasDraft()) {
if (Authorizer.Authorize(Permissions.PublishContent, contentPart)) {
@Html.Link(T("Publish Draft").Text, Url.Action("Publish", "Admin", new {area = "Contents", id = contentPart.ContentItem.Id, returnUrl = Request.ToUrlString()}), new {itemprop = "UnsafeUrl"})
@Html.Link(T("Publish Draft").Text, Url.Action("Publish", "Admin", new {area = "Contents", id = contentPart.ContentItem.Id, returnUrl = Request.RawUrl}), new {itemprop = "UnsafeUrl"})
@T(" | ")
}
@@ -23,7 +23,7 @@
}
if (Authorizer.Authorize(Permissions.PublishContent, contentPart)) {
@Html.Link(T("Unpublish").Text, Url.Action("Unpublish", "Admin", new {area = "Contents", id = contentPart.ContentItem.Id, returnUrl = Request.ToUrlString()}), new {itemprop = "UnsafeUrl"})
@Html.Link(T("Unpublish").Text, Url.Action("Unpublish", "Admin", new {area = "Contents", id = contentPart.ContentItem.Id, returnUrl = Request.RawUrl}), new {itemprop = "UnsafeUrl"})
@T(" | ")
}
} else {
@@ -35,7 +35,7 @@
}
if (Authorizer.Authorize(Permissions.PublishContent, contentPart)) {
@Html.Link(T("Publish").Text, Url.Action("Publish", "Admin", new {area = "Contents", id = contentPart.ContentItem.Id, returnUrl = Request.ToUrlString()}), new {itemprop = "UnsafeUrl"})
@Html.Link(T("Publish").Text, Url.Action("Publish", "Admin", new {area = "Contents", id = contentPart.ContentItem.Id, returnUrl = Request.RawUrl}), new {itemprop = "UnsafeUrl"})
@T(" | ")
}
}

View File

@@ -5,10 +5,10 @@
}
@if (Model.ContentPart.Status == SpamStatus.Spam) {
@Html.Link(@T("Not Spam").Text, Url.Action("ReportHam", "Admin", new {area = "Orchard.AntiSpam", part.Id, returnUrl = Request.ToUrlString()}), new {itemprop = "UnsafeUrl"})
@Html.Link(@T("Not Spam").Text, Url.Action("ReportHam", "Admin", new {area = "Orchard.AntiSpam", part.Id, returnUrl = Request.RawUrl }), new {itemprop = "UnsafeUrl"})
}
else {
@Html.Link(@T("Spam").Text, Url.Action("ReportSpam", "Admin", new {area = "Orchard.AntiSpam", part.Id, returnUrl = Request.ToUrlString()}), new {itemprop = "UnsafeUrl"})
@Html.Link(@T("Spam").Text, Url.Action("ReportSpam", "Admin", new {area = "Orchard.AntiSpam", part.Id, returnUrl = Request.RawUrl }), new {itemprop = "UnsafeUrl"})
}
@T(" | ")

View File

@@ -14,7 +14,7 @@
@Html.SelectOption(ContentsBulkAction.None, ContentsBulkAction.None, T("Choose action...").ToString())
@Html.SelectOption(ContentsBulkAction.None, ContentsBulkAction.Remove, T("Delete").ToString())
</select>
@Html.Hidden("returnUrl", ViewContext.RequestContext.HttpContext.Request.ToUrlString())
@Html.Hidden("returnUrl", ViewContext.RequestContext.HttpContext.Request.RawUrl)
<button type="submit" name="submit.BulkEdit" value="yes">@T("Apply")</button>
</fieldset>
<fieldset class="contentItems bulk-items">

View File

@@ -4,7 +4,7 @@
@{
Script.Require("ShapesBase");
ContentItem contentItem = Model.ContentItem;
var returnUrl = ViewContext.RequestContext.HttpContext.Request.ToUrlString();
var returnUrl = ViewContext.RequestContext.HttpContext.Request.RawUrl;
}
<div class="summary" itemscope="itemscope" itemid="@contentItem.Id" itemtype="http://orchardproject.net/data/ContentItem">
<div class="properties">
@@ -26,7 +26,7 @@
if (contentItem.HasDraft()) {
if (Authorizer.Authorize(Orchard.Blogs.Permissions.PublishBlogPost, contentItem)) {
@Html.Link(T("Publish Draft").Text, Url.Action("Publish", "Admin", new { area = "Contents", id = contentItem.Id, returnUrl = Request.ToUrlString() }), new { itemprop = "UnsafeUrl" })
@Html.Link(T("Publish Draft").Text, Url.Action("Publish", "Admin", new { area = "Contents", id = contentItem.Id, returnUrl = Request.RawUrl }), new { itemprop = "UnsafeUrl" })
@T(" | ")
}
@@ -37,7 +37,7 @@
}
if (Authorizer.Authorize(Orchard.Blogs.Permissions.PublishBlogPost, contentItem)) {
@Html.Link(T("Unpublish").Text, Url.Action("Unpublish", "Admin", new { area = "Contents", id = contentItem.Id, returnUrl = Request.ToUrlString() }), new { itemprop = "UnsafeUrl" })
@Html.Link(T("Unpublish").Text, Url.Action("Unpublish", "Admin", new { area = "Contents", id = contentItem.Id, returnUrl = Request.RawUrl}), new { itemprop = "UnsafeUrl" })
@T(" | ")
}
} else {
@@ -49,7 +49,7 @@
}
if (Authorizer.Authorize(Orchard.Blogs.Permissions.PublishBlogPost, contentItem)) {
@Html.Link(T("Publish").Text, Url.Action("Publish", "Admin", new { area = "Contents", id = contentItem.Id, returnUrl = Request.ToUrlString() }), new { itemprop = "UnsafeUrl" })
@Html.Link(T("Publish").Text, Url.Action("Publish", "Admin", new { area = "Contents", id = contentItem.Id, returnUrl = Request.RawUrl }), new { itemprop = "UnsafeUrl" })
@T(" | ")
}
}

View File

@@ -11,7 +11,7 @@
@Html.SelectOption(ContentsBulkAction.None, ContentsBulkAction.Unpublish, T("Unpublish").ToString())
@Html.SelectOption(ContentsBulkAction.None, ContentsBulkAction.Remove, T("Delete").ToString())
</select>
@Html.Hidden("returnUrl", ViewContext.RequestContext.HttpContext.Request.ToUrlString())
@Html.Hidden("returnUrl", ViewContext.RequestContext.HttpContext.Request.RawUrl)
<button type="submit" name="submit.BulkEdit" value="yes">@T("Apply")</button>
</fieldset>
<fieldset class="contentItems bulk-items">

View File

@@ -34,7 +34,7 @@ namespace Orchard.Comments {
Area = "Orchard.Comments",
Controller = "Admin",
id = item.Id,
returnUrl = Html.ViewContext.HttpContext.Request.ToUrlString()
returnUrl = Html.ViewContext.HttpContext.Request.RawUrl
});
}

View File

@@ -89,13 +89,13 @@
<td>
<div class="actions">
@if (commentEntry.Comment.Status != CommentStatus.Approved) {
<a href="@Url.Action("Approve", new {commentEntry.Comment.Id, returnUrl = Request.ToUrlString()})" itemprop="ApproveUrl UnsafeUrl">@T("Approve")</a>@T(" | ")
<a href="@Url.Action("Approve", new {commentEntry.Comment.Id, returnUrl = Request.RawUrl})" itemprop="ApproveUrl UnsafeUrl">@T("Approve")</a>@T(" | ")
}
else {
<a href="@Url.Action("Unapprove", new {commentEntry.Comment.Id, returnUrl = Request.ToUrlString()})" itemprop="UnapproveUrl UnsafeUrl">@T("Unapprove")</a>@T(" | ")
<a href="@Url.Action("Unapprove", new {commentEntry.Comment.Id, returnUrl = Request.RawUrl})" itemprop="UnapproveUrl UnsafeUrl">@T("Unapprove")</a>@T(" | ")
}
<a href="@Url.Action("Edit", new {commentEntry.Comment.Id})" title="@T("Edit")">@T("Edit")</a>@T(" | ")
<a href="@Url.Action("Delete", new {commentEntry.Comment.Id, returnUrl = ViewContext.RequestContext.HttpContext.Request.ToUrlString()})" itemprop="RemoveUrl UnsafeUrl">@T("Delete")</a>
<a href="@Url.Action("Delete", new {commentEntry.Comment.Id, returnUrl = ViewContext.RequestContext.HttpContext.Request.RawUrl})" itemprop="RemoveUrl UnsafeUrl">@T("Delete")</a>
</div>
</td> </tr>
commentIndex = commentIndex + 1;

View File

@@ -10,10 +10,10 @@
@if(settings.ModerateComments) {
if (comment.Status != CommentStatus.Pending) {
@Html.Link(@T("Approve").Text, Url.Action("Approve", "Admin", new {area = "Orchard.Comments", comment.Id, returnUrl = Request.ToUrlString()}), new {itemprop = "UnsafeUrl"})
@Html.Link(@T("Approve").Text, Url.Action("Approve", "Admin", new {area = "Orchard.Comments", comment.Id, returnUrl = Request.RawUrl }), new {itemprop = "UnsafeUrl"})
}
else {
@Html.Link(@T("Unapprove").Text, Url.Action("Unapprove", "Admin", new {area = "Orchard.Comments", comment.Id, returnUrl = Request.ToUrlString()}), new {itemprop = "UnsafeUrl"})
@Html.Link(@T("Unapprove").Text, Url.Action("Unapprove", "Admin", new {area = "Orchard.Comments", comment.Id, returnUrl = Request.RawUrl }), new {itemprop = "UnsafeUrl"})
}
@T(" | ")
}

View File

@@ -28,7 +28,7 @@ else if (WorkContext.CurrentUser != null && !isAuthorized) {
else if (isAuthorized) {
@Html.ValidationSummary()
<span id="comment-form-beacon"></span>
using (Html.BeginFormAntiForgeryPost(Url.Action("Create", "Comment", new { Area = "Orchard.Comments", ReturnUrl = Context.Request.ToUrlString() }), FormMethod.Post, new { @class = "comment-form" })) {
using (Html.BeginFormAntiForgeryPost(Url.Action("Create", "Comment", new { Area = "Orchard.Comments", ReturnUrl = Context.Request.RawUrl }), FormMethod.Post, new { @class = "comment-form" })) {
if (TempData.ContainsKey("Comments.InvalidCommentEditorShape")) {
@Display(TempData["Comments.InvalidCommentEditorShape"]);
}

View File

@@ -4,7 +4,7 @@
Style.Require("ContentTypesAdmin");
Script.Require("jQuery");
Layout.Title = T("Edit Content Type - {0}", Html.Raw(Model.DisplayName)).Text;
var returnUrl = ViewContext.RequestContext.HttpContext.Request.ToUrlString();
var returnUrl = ViewContext.RequestContext.HttpContext.Request.RawUrl;
}
<div class="manage">

View File

@@ -1,7 +1,7 @@
@using Orchard.Utility.Extensions
@model Orchard.ContentTypes.ViewModels.EditPartFieldViewModel
@{
var returnUrl = ViewContext.RequestContext.HttpContext.Request.ToUrlString();
var returnUrl = ViewContext.RequestContext.HttpContext.Request.RawUrl;
}
<fieldset class="manage-field">
<h3>@Model.DisplayName <span>(@Model.FieldDefinition.Name.CamelFriendly())</span></h3>

View File

@@ -15,7 +15,7 @@
@Html.SelectOption(ContentsBulkAction.None, ContentsBulkAction.Unpublish, T("Unpublish").ToString())
@Html.SelectOption(ContentsBulkAction.None, ContentsBulkAction.Remove, T("Delete").ToString())
</select>
@Html.Hidden("returnUrl", ViewContext.RequestContext.HttpContext.Request.ToUrlString())
@Html.Hidden("returnUrl", ViewContext.RequestContext.HttpContext.Request.RawUrl)
<button type="submit" name="submit.BulkEdit" value="yes">@T("Apply")</button>
</fieldset>
<fieldset class="contentItems bulk-items">

View File

@@ -3,7 +3,7 @@
@using Orchard.Utility.Extensions;
@{
ContentItem contentItem = Model.ContentItem;
var returnUrl = ViewContext.RequestContext.HttpContext.Request.ToUrlString();
var returnUrl = ViewContext.RequestContext.HttpContext.Request.RawUrl;
}
<div class="summary-condensed" itemscope="itemscope" itemid="@contentItem.Id" itemtype="http://orchardproject.net/data/ContentItem">
<div class="properties">

View File

@@ -8,7 +8,7 @@
string name = field.Name;
var mediaParts = field.MediaParts;
var returnUrl = ViewContext.RequestContext.HttpContext.Request.ToUrlString();
var returnUrl = ViewContext.RequestContext.HttpContext.Request.RawUrl;
}
<span class="name">@displayName:</span>
<p class="media-library-picker-field media-library-picker-field-@name.HtmlClassify()">

View File

@@ -28,7 +28,7 @@
T("Uninstall").Text,
"UninstallModule",
"PackagingServices",
new { ModuleId = module.Descriptor.Id, ReturnUrl = Request.ToUrlString(), Area = "Orchard.Packaging" },
new { ModuleId = module.Descriptor.Id, ReturnUrl = Request.RawUrl, Area = "Orchard.Packaging" },
new { itemprop = "RemoveUrl UnsafeUrl" })
@if (!String.IsNullOrEmpty(module.Descriptor.Description)) {

View File

@@ -26,7 +26,7 @@
}
<fieldset class="update-actions">
<a class="button" href="@Url.Action("ReloadUpdates", new { returnUrl = ViewContext.RequestContext.HttpContext.Request.ToUrlString()})" title="@T("Most recent check for updates: {0}", Model.LastUpdateCheckUtc == null ? T("Unknown") : Display.DateTimeRelative(DateTimeUtc: Model.LastUpdateCheckUtc.Value))">@T("Check for Updates")</a>
<a class="button" href="@Url.Action("ReloadUpdates", new { returnUrl = ViewContext.RequestContext.HttpContext.Request.RawUrl})" title="@T("Most recent check for updates: {0}", Model.LastUpdateCheckUtc == null ? T("Unknown") : Display.DateTimeRelative(DateTimeUtc: Model.LastUpdateCheckUtc.Value))">@T("Check for Updates")</a>
</fieldset>
@if (Model.Entries.Count() <= 0) {

View File

@@ -26,7 +26,7 @@
}
<fieldset class="update-actions">
<a class="button" href="@Url.Action("ReloadUpdates", new { returnUrl = ViewContext.RequestContext.HttpContext.Request.ToUrlString()})" title="@T("Most recent check for updates: {0}", Model.LastUpdateCheckUtc == null ? T("Unknown") : Display.DateTimeRelative(DateTimeUtc: Model.LastUpdateCheckUtc.Value))" >@T("Check for Updates")</a>
<a class="button" href="@Url.Action("ReloadUpdates", new { returnUrl = ViewContext.RequestContext.HttpContext.Request.RawUrl})" title="@T("Most recent check for updates: {0}", Model.LastUpdateCheckUtc == null ? T("Unknown") : Display.DateTimeRelative(DateTimeUtc: Model.LastUpdateCheckUtc.Value))" >@T("Check for Updates")</a>
</fieldset>
@if (Model.Entries.Count() <= 0) {

View File

@@ -39,7 +39,7 @@
@Html.ActionLink(T("Edit").ToString(), "Edit", new { row.Id })
@if (row.Name != "Administrator") {
@T(" | ")
<a href="@Url.Action("Delete", new {row.Id, returnUrl = ViewContext.RequestContext.HttpContext.Request.ToUrlString()})" itemprop="RemoveUrl UnsafeUrl">@T("Delete")</a>
<a href="@Url.Action("Delete", new {row.Id, returnUrl = ViewContext.RequestContext.HttpContext.Request.RawUrl})" itemprop="RemoveUrl UnsafeUrl">@T("Delete")</a>
}
</td>
</tr>

View File

@@ -44,7 +44,7 @@
</td>
<td>
@Html.ActionLink(T("Edit").ToString(), "Edit", new {id = tagEntry.Tag.Id}) @T(" | ")
<a href="@Url.Action("Remove", new {tagEntry.Tag.Id, returnUrl = ViewContext.RequestContext.HttpContext.Request.ToUrlString()})" itemprop="RemoveUrl UnsafeUrl">@T("Delete")</a>
<a href="@Url.Action("Remove", new {tagEntry.Tag.Id, returnUrl = ViewContext.RequestContext.HttpContext.Request.RawUrl})" itemprop="RemoveUrl UnsafeUrl">@T("Delete")</a>
</td>
</tr>
tagIndex = tagIndex + 1;

View File

@@ -68,7 +68,7 @@
T("Uninstall").Text,
"UninstallTheme",
"PackagingServices",
new { ThemeId = theme.Descriptor.Id, ReturnUrl = Request.ToUrlString(), Area = "Orchard.Packaging" },
new { ThemeId = theme.Descriptor.Id, ReturnUrl = Request.RawUrl, Area = "Orchard.Packaging" },
new { itemprop = "RemoveUrl UnsafeUrl" })
}
</div>

View File

@@ -31,19 +31,19 @@
@if (widget.HasPublished()) {
if (widget.HasDraft()) {
if (Authorizer.Authorize(Permissions.PublishContent, widget)) {
@Html.Link(T("Publish Draft").Text, Url.Action("Publish", "Admin", new { area = "Contents", id = widget.ContentItem.Id, returnUrl = Request.ToUrlString() }), new { itemprop = "UnsafeUrl" })
@Html.Link(T("Publish Draft").Text, Url.Action("Publish", "Admin", new { area = "Contents", id = widget.ContentItem.Id, returnUrl = Request.RawUrl }), new { itemprop = "UnsafeUrl" })
@T(" | ")
}
}
if (Authorizer.Authorize(Permissions.PublishContent, widget)) {
@Html.Link(T("Unpublish").Text, Url.Action("Unpublish", "Admin", new { area = "Contents", id = widget.ContentItem.Id, returnUrl = Request.ToUrlString() }), new { itemprop = "UnsafeUrl" })
@Html.Link(T("Unpublish").Text, Url.Action("Unpublish", "Admin", new { area = "Contents", id = widget.ContentItem.Id, returnUrl = Request.RawUrl }), new { itemprop = "UnsafeUrl" })
@T(" | ")
}
}
else {
if (Authorizer.Authorize(Permissions.PublishContent, widget)) {
@Html.Link(T("Publish").Text, Url.Action("Publish", "Admin", new { area = "Contents", id = widget.ContentItem.Id, returnUrl = Request.ToUrlString() }), new { itemprop = "UnsafeUrl" })
@Html.Link(T("Publish").Text, Url.Action("Publish", "Admin", new { area = "Contents", id = widget.ContentItem.Id, returnUrl = Request.RawUrl }), new { itemprop = "UnsafeUrl" })
@T(" | ")
}
}

View File

@@ -45,7 +45,7 @@ namespace Orchard.Environment {
if (!httpContext.IsBackgroundContext()) {
// Don't redirect posts...
if (httpContext.Request.RequestType == "GET") {
httpContext.Response.Redirect(HttpContext.Current.Request.ToUrlString(), true /*endResponse*/);
httpContext.Response.Redirect(HttpContext.Current.Request.RawUrl, true /*endResponse*/);
}
else {
httpContext.Response.ContentType = "text/html";