Closed Bug 1145580 Opened 9 years ago Closed 9 years ago

[Page move] Do not allow "/" as the last character for the destination

Categories

(developer.mozilla.org Graveyard :: General, defect)

All
Other
defect
Not set
minor

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: fs, Unassigned)

Details

(Whiteboard: [specification][type:bug])

What did you do?
================
1. Moved https://developer.mozilla.org/en-US/docs/nsLocalFile to https://developer.mozilla.org/en-US/docs/Mozilla/Tech/XPCOM/Reference/Components/

What happened?
==============
I was too quick and the URL https://developer.mozilla.org/en-US/docs/Mozilla/Tech/XPCOM/Reference/Components/ is wrong.

The document is now inaccessible as the trailing slash gets removed by Firefox and I only get to see
https://developer.mozilla.org/en-US/docs/Mozilla/Tech/XPCOM/Reference/Components

What should have happened?
==========================
I should have been less quick and moved the page to https://developer.mozilla.org/en-US/docs/Mozilla/Tech/XPCOM/Reference/Components/nsLocalFile

However, the wrong slug was not caught either. Probably should have been.

So, do not perform page moves, if the last character in the destination URL is a slash "/".

Is there anything else we should know?
======================================
Please move the inaccessible doc to the right location, too.

I will be less quick next time.
:groovecoder, can you help restore the page? Fixing the trailing slash bug is a minor priority, but we've lost some content.
Severity: normal → minor
Flags: needinfo?(lcrouch)
I'm confused ... the title of https://developer.mozilla.org/admin/wiki/document/10791/ is "nsDirectoryService" ? That doesn't seem like it should be the nsLocalFile article?
Flags: needinfo?(lcrouch) → needinfo?(fscholz)
Yes, and that title is correct.

The slug is wrong:
It is:         [1] Mozilla/Tech/XPCOM/Reference/Components/
but should be: [2] Mozilla/Tech/XPCOM/Reference/Components/nsLocalFile

The parent page is also correct, it is without a slash at the end:
               [3] Mozilla/Tech/XPCOM/Reference/Components

Currently, [1] redirects to [3], but they are actually two document. That is why the slug [1] needs to become slug [2] (and that is what I intended to do but did wrongly).
Flags: needinfo?(fscholz)
Something else strange has happened ... 

d = Document.objects.get(slug='Mozilla/Tech/XPCOM/Reference/Components/', locale='en-US')
d2 = Document.objects.get(slug='Mozilla/Tech/XPCOM/Reference/Components/nsLocalFile', locale='en-US')

In [16]: d.slug
Out[16]: 'Mozilla/Tech/XPCOM/Reference/Components/nsLocalFile'

In [17]: d2.slug
Out[17]: u'Mozilla/Tech/XPCOM/Reference/Components/nsLocalFile'

So there's still an 'nsLocaleFile' in the database, and it won't let me move Components/ into it. Furthermore, https://developer.mozilla.org/en-US/docs/Mozilla/Tech/XPCOM/Reference/Components/nsLocalFile is still accessible. So what is triggering requests to Components/ ? If nothing, I can delete the erroneous Components/ doc.
Argh, sorry.

'nsDirectoryService' is the one not nsLocalFile.

Although in/out [16] is still weird.

https://developer.mozilla.org/admin/wiki/document/10791/ says:
/en-US/docs/Mozilla/Tech/XPCOM/Reference/Components/ (nsDirectoryService)

Which I interpret as: 
/slug/ (title)
Updated:

In [1]: from kuma.wiki.models import Document

In [2]: nsDirectoryService = Document.objects.get(slug='Mozilla/Tech/XPCOM/Reference/Components/', locale='en-US')

In [3]: nsDirectoryService.slug
Out[3]: u'Mozilla/Tech/XPCOM/Reference/Components/'

In [4]: nsDirectoryService.slug = u'Mozilla/Tech/XPCOM/Reference/Components/nsDirectoryService'

In [5]: nsDirectoryService.save()

https://developer.mozilla.org/en-US/docs/Mozilla/Tech/XPCOM/Reference/Components/nsDirectoryService is now reachable. 

https://developer.mozilla.org/en-US/docs/Mozilla/Tech/XPCOM/Reference/Components/ seems to correctly redirect to https://developer.mozilla.org/en-US/docs/Mozilla/Tech/XPCOM/Reference/Components though it doesn't seem to be correctly finding/showing the link to nsDirectoryService ?
The restoring of the document was successful. Thanks!

Leaving this open to fix the actual problem of having the last character in the destination URL being a slash "/". We should not allow it.
I've submitted a PR that fixes this issue by removing the trailing slash if one is present in the slug: https://github.com/mozilla/kuma/pull/3176
Status: NEW → RESOLVED
Closed: 9 years ago
Resolution: --- → FIXED
Product: developer.mozilla.org → developer.mozilla.org Graveyard
You need to log in before you can comment on or make changes to this bug.