Last modified: 2013-10-09 18:03:44 UTC

Wikimedia Bugzilla is closed!

Wikimedia migrated from Bugzilla to Phabricator. Bug reports are handled in Wikimedia Phabricator.
This static website is read-only and for historical purposes. It is not possible to log in and except for displaying bug reports and their history, links might be broken. See T33827, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 31827 - Respond with valid JS/CSS on redirects when using action=raw&ctype=text/css or action=raw&ctype=text/javascript
Respond with valid JS/CSS on redirects when using action=raw&ctype=text/css o...
Status: REOPENED
Product: MediaWiki
Classification: Unclassified
Redirects (Other open bugs)
unspecified
All All
: Normal normal (vote)
: ---
Assigned To: Nobody - You can work on this!
https://en.wikipedia.org/w/index.php?...
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2011-10-19 19:38 UTC by Helder
Modified: 2013-10-09 18:03 UTC (History)
4 users (show)

See Also:
Web browser: ---
Mobile Platform: ---
Assignee Huggle Beta Tester: ---


Attachments

Description Helder 2011-10-19 19:38:24 UTC
This is a followup for bug 30074.

I think it would be better if the result of using "action=raw&ctype=text/javascript" or "action=raw&ctype=text/css" were changed to output nothing (or just an informative comment) if the target page is a redirect. This way the users who import a page which was moved will not have broken scripts and stylesheets.

Would that be feasible by some change similar to r94155 ?
Comment 1 Brion Vibber 2011-10-19 22:12:39 UTC
I'm pretty sure that would still by definition break their scripts/styles by removing them...?
Comment 2 Helder 2011-10-19 22:30:19 UTC
At least it wouldn't cause syntax errors as currently happens, breaking other scripts as well.
Comment 3 Brion Vibber 2011-10-19 22:33:37 UTC
Syntax errors shouldn't be breaking other scripts unless they're being bundled together in ResourceLoader and somebody disabled the JS validity checks.

If they're coming from action=raw, then they're not going through ResourceLoader's bundling at all -- so a failure should only halt execution of that script, not any others.

An error message on your JS console will however alert you to the presence of an error, won't it? Seems like it would be useful for helping people to find their broken scripts.
Comment 4 Helder 2011-10-19 23:18:39 UTC
(In reply to comment #2)
>...breaking other scripts as well.

Er.. I just checked this with a code like the following on my /common.js

mw.loader.load( 'http://localhost/mw18/index.php?title=MediaWiki:Test1.js&action=raw&ctype=text/javascript' );
mw.loader.load( 'http://localhost/mw18/index.php?title=MediaWiki:Test2.js&action=raw&ctype=text/javascript' );

and then moving "MediaWiki:Test1.js" to another name. As you explained, this didn't break "MediaWiki:Test2.js", so never mind...
Comment 5 Waldir 2011-12-05 12:11:17 UTC
(In reply to comment #1)
> I'm pretty sure that would still by definition break their scripts/styles by
> removing them...?

Why not actually making redirects work in css and js pages? Is there anything that makes this fundamentally more complicated than other cases? By now we're using redirects for pages, images, templates, and it all works seamlessly.
Comment 6 Helder 2012-01-26 20:15:49 UTC
(In reply to comment #5)
> Why not actually making redirects work in css and js pages? Is there anything
> that makes this fundamentally more complicated than other cases? By now we're
> using redirects for pages, images, templates, and it all works seamlessly.

+1.

I've openned bug 33973 requesting that.
Comment 7 Krinkle 2012-07-22 03:03:02 UTC
Example urls:
* https://en.wikipedia.org/w/index.php?title=MediaWiki:Doesnteixst.css&action=raw&ctype=text/css
* https://en.wikipedia.org/w/index.php?title=User:Krinkle/Doesnteixst.js&action=raw&ctype=text/javascript

(In reply to comment #5)
> (In reply to comment #1)
> > I'm pretty sure that would still by definition break their scripts/styles by
> > removing them...?
> 
> Why not actually making redirects work in css and js pages? Is there anything
> that makes this fundamentally more complicated than other cases? By now we're
> using redirects for pages, images, templates, and it all works seamlessly.

Because contrary to all of the above, CSS and javascript are not Wiki-specific objects. They are native scripts interpreted by the browser - while at the same time being an ordinary wikipage that should be editable, watchable, and... redirectable (when viewing normally).

I've wontfixed bug 33973 (see reason there), and re-opening this one.

We should make action=raw respond with valid CSS or JavaScript when requesting ctype=text/css or ctype=text/javascript on a redirect. Just like we used to do for non-existent ones (by reponding with HTTP 200 OK; Content: /* Empty */; - instead of HTTP 404 Not Found).

For redirects we can do something like HTTP 200 OK: Content: /* Redirect */

It is important that this only happens for those content types. In other cases it should respond with the original wikitext as expected, as other wise it could break bots and scripts.
Comment 8 Helder 2012-07-22 19:13:31 UTC
(In reply to comment #7)
> For redirects we can do something like HTTP 200 OK: Content: /* Redirect */

In that case, make sure the "Redirect" text is in site language (as in bug 28937).

Note You need to log in before you can comment on or make changes to this bug.


Navigation
Links