In the screen admin/config/search/path/edit/[NODE]?destination=admin/config/search/path there is a box to enter the URL alias.

The UI displays the site domain, with the current language's URL suffix, but with no trailing slash. Since there will be a slash when viewing the content, this should be added to the UI for clarity.

See the screenshot for details.

Comments

davidwhthomas’s picture

This text update to the label can be done in path_admin_form
http://api.drupal.org/api/drupal/modules%21path%21path.admin.inc/functio...
DT

webflo’s picture

Project: Internationalization » Drupal core
Version: 7.x-1.5 » 8.x-dev
Component: User interface » path.module
Issue tags: +UX
StatusFileSize
new241.63 KB
new264.8 KB

Its not a i18n problem. This a core bug. I made two screenshots to illustrate the issue.

webflo’s picture

Issue tags: +useability

Tagging.

webflo’s picture

Issue tags: -useability +Usability

Tagging.

devin carlson’s picture

Title: URL Detection path alias screen needs extra / » Add a trailing slash to field prefixes which display a URL
Component: path.module » user interface text
Category: bug » task
Status: Active » Needs review
Issue tags: +Needs backport to D7
StatusFileSize
new3.53 KB

Might as well make the use of a trailing slash on field prefixes which display a URL consistent!

devin carlson’s picture

Issue tags: +Novice

This looks like a good novice issue (check if the old patch still applies, check if it fixed all occurrences of fields with use a URL prefix, reroll or update as necessary).

JulienD’s picture

Adding a trailing slash on field prefixes solve the problem for urls having a language code but not for the default url because you will display a double trailing slash.

The problem come from the url() function that can return an url with a trailing slash at the end or not.

JulienD’s picture

To solve the problem I did a preg_replace on the generated url to enforce a trailing slash at the end of it. I found that solution in the trailing_slash module.

$url = url(NULL, array('absolute' => TRUE));
// $path could be equal to http://example.local/ or http://example.local/fr
$url = preg_replace('/((?:^|\\/)[^\\/\\.]+?)$/isD', '$1/', $path);
// After the preg_replace, $path will be http://example.local/ or http://example.local/fr/

I rerolled your patch to apply that solution.

I not really convinced by the fast of creating a $url variable to store that information but that reduce the number of url() calls and preg_replace iteration. Let me know if you've got a better idea !

How to test :
- Requirements:
1) Activate the language module
2) Add a new language

- Test the default url :
Go to example.com/admin/config/search/path/add (replace example.com by your website url)
The url displayed should be http://example.com/

- Test the url with a language code :
Go to example.com/[LANGUAGE_CODE]/admin/config/search/path/add
The url displayed should be http://example.com/[LANGUAGE_CODE]/

JulienD’s picture

$path_prefix seems to be a better naming than $url.

Also patched the same problem on Views :

Add a new views, and create a page display : http://example.com/[LANGUAGE_CODE]/admin/structure/views/add
views_admin_creation.png

Edit your views and change the page path
views_update_path.png

enhdless’s picture

Patch is in need of rerolling.

enhdless’s picture

Issue summary: View changes
Status: Needs review » Needs work
ivanstegic’s picture

Assigned: Unassigned » ivanstegic
Issue tags: +SprintWeekend2013

Assigning to myself as part of Global Sprint Weekend.

ivanstegic’s picture

Status: Needs work » Needs review
StatusFileSize
new1.55 KB

Rerolled the patch.

webflo’s picture

Issue tags: -SprintWeekend2013 +SprintWeekend
ivanstegic’s picture

Since this needs to be backported, here's a patch for D7. The steps are a little different to recreate than in D8:

  1. Enable the "locale" module.
  2. Add a new language: admin/config/regional/language/add
  3. Enable URL detection method: admin/config/regional/language/configure -- path prefix option works the same as in D8
  4. Going to: admin/config/search/path/add looks good, while [LANGUAGE_CODE]/admin/config/search/path/add is missing the slash

This patch addresses the issue in D7 and will cause the auto test to fail for the patch.

Status: Needs review » Needs work
ivanstegic’s picture

Status: Needs work » Needs review

The last submitted patch failed because it is for the D7 branch, so I'm switching this to Needs Review. Please look at #13 for the D8 Core Patch

greggillingham’s picture

Reviewd #13 and confirmed /[LANGUAGE_CODE]/admin/config/search/path/add
Result: shows trailing slash

Tested for trailing slash on views as per #9 but with patch from #13: /[LANGUAGE_CODE]/admin/structure/views/add
Result: does not show trailing slash

les lim’s picture

Status: Needs review » Needs work

The testbot tests against the core version indicated in the issue status. You can let the testbot know to skip a particular patch file by putting "do-not-test" in the patch filename. That's documented here: https://drupal.org/node/332678

+++ b/core/modules/path/path.admin.inc
@@ -136,6 +136,9 @@ function path_admin_edit($path = array()) {
+  ¶
+  $url = preg_replace('/((?:^|\\/)[^\\/\\.]+?)$/isD', '$1/', url(NULL, array('absolute' => TRUE)));
+

There's extra whitespace on the first blank line.

There should be a comment describing the intention of that line. That's not a particularly readable regex.

And actually, if we're just making sure there's a slash at the end, do we really need a preg_replace()?

$url = url(NULL, array('absolute' => TRUE));
// Ensure that the URL prefix ends in a slash.
if (strpos(strrev($url), '/') !== 0) {
  $url .= '/';
}
ivanstegic’s picture

I think I agree, Les. I don't see a reason why we can't just check for the slash and then put it there if it isn't. Anyone else see a problem with this?

visabhishek’s picture

Hi,
I have created a patch based on #19.

visabhishek’s picture

Hi,
Alter the comment description. (// Ensure that URL prefix ends with a slash.)

chakrapani’s picture

Status: Needs work » Needs review

setting to needs review so that test bot can pickup..

valthebald’s picture

Status: Needs review » Reviewed & tested by the community

Patch works and applies fine, yet I could not reproduce the issue with the latest HEAD (fixed by earlier commit?)

valthebald’s picture

Status: Reviewed & tested by the community » Closed (cannot reproduce)
alimac’s picture

Issue tags: -SprintWeekend +SprintWeekend2014

Minor tag cleanup - please ignore.