"Reedy" posted a comment on MediaWiki.r109562.
URL: http://www.mediawiki.org/wiki/Special:Code/MediaWiki/109562#c29784

Commit summary for MediaWiki.r109562:

* (bug 32341) Add upload by URL domain limitation.

Reedy's comment:

Well, yes, if you then do something fancy like putting it in some other part, 
you can fool it. But for the Wikipedia use case, that won't work anyway

How should it be done? Unless we include protocols in the listed urls, and then 
check if it's at the start of the string? Or go to the extent of extracting the 
host from the given url (do we have a nice way in MW to do this? Feels like 
it'd be re-inventing the wheel)... And then becomes protocol irrelevant...

We currently have in WikiMap, and is similarily basic...

<pre>
        /**
         * @return string
         * @throws MWException
         */
        public function getHostname() {
                $prefixes = array( 'http://', 'https://' );
                foreach ( $prefixes as $prefix ) {
                        if ( substr( $this->mCanonicalServer, 0, strlen( 
$prefix ) ) ) {
                                return substr( $this->mCanonicalServer, strlen( 
$prefix ) );
                        }
                }
                throw new MWException( "Invalid hostname for wiki 
{$this->mMinor}.{$this->mMajor}" );
        }
</pre>

The hook is an extension to this, so isn't a major issue to be done now

_______________________________________________
MediaWiki-CodeReview mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-codereview

Reply via email to