2

In a MediaWiki page, I'd like to add an URL to a file on a file server. The path is an UNC one(\\fileserver\project\...\SPECIAL.ext), and I already have tried following "path link":

file:////fileserver/projet/.../SPECIAL.ext

I know this is correct: when I enter this location in the address bar of my internet browser, automatically the file gets downloaded.

However, when I put the following line in a Mediawiki page, it doesn't work:

[file:////fileserver/projet/.../SPECIAL.ext]

Not working simply means that I just see "[file:...]" on the page (apparently Mediawiki does not understand that the square brackets are used for defining an URL. When I remove the square brackets, still no good result, I just see "file:...").

However, there are some URLs inside my wiki (they just start with http://), so I have the impression that my MediaWiki doesn't know that file:// has a similar meaning than http://. How do I configure my MediaWiki for this?

Oh, I prefer solving this issue using a simple configuration, if possible. I'd like to avoid installing extensions.

4
  • It’s not unlikely file: URIs are forbidden entirely.
    – Daniel B
    Commented Jun 8, 2021 at 11:44
  • @DanielB: your comment might mean that I need to use another way to create a "download" link on a MediaWiki page. It's important that it is not a link to a file on the MediaWiki server, but on another one. Do you know another way to do this?
    – Dominique
    Commented Jun 8, 2021 at 11:47
  • @DanielB: in the meantime I tried using http:// instead of file://. This works, but http:////fileserver/projet gets translated into fileserver/projet instead of \\fileserver\projet, no matter how many slashes I put (2, 4, 6, ...).
    – Dominique
    Commented Jun 8, 2021 at 11:53
  • Nobody knows how to put slashes in front of an UNC path for mediawiki?
    – Dominique
    Commented Jun 10, 2021 at 13:31

2 Answers 2

0
+100

Here's the thing: It won't work for others.

Wikipedia sandbox error

Perhaps you could:

  1. Try to provide a link to it on the Internet
  2. Upload it with Special:Upload if the .ext file format is supported.

Perhaps that's why MW ignores it.

EDIT: To address recent comments, it's possible that MW is not adapted to file:// at all, though we don't know for sure.

2
  • Your error statement says that links, starting with file:// point to files on your own computer, but in my case, I'm working with a file server, where everybody has access to, but there is no IIS on that machine, so http:// does not work. In a first comment on my question, someone mentioned that file:// URI usage is completely forbidden. Isn't there a way to allow it exceptionally?
    – Dominique
    Commented Jun 15, 2021 at 14:08
  • That's probably the case since MW isn't adapted to working with file servers. Wikipedia, the first MW wiki, didn't and won't have to deal with such situations. Commented Jun 17, 2021 at 6:19
1

There should be a variable in LocalSettings.php called $wgUrlProtocols. According to the comment before that variable in DefaultSettings.php, you can add file:// to it. I think that means links to a file server should then work.

3
  • I'm planning to do this, but once I've finished, is there something I need to restart in order to make this work?
    – Dominique
    Commented Jun 28, 2021 at 9:24
  • I believe that adding this entry turns file:// entries into URLs, which is working fine indeed, but we're not there yet: when I put file:////fileserver or file://\\fileserver I see he wants to go to fileserver (without slashes or backslashes). I also tried replacing the (back)slashes by ´%2f´ or %5c (their ASCII codes), but that didn't help either.
    – Dominique
    Commented Jun 28, 2021 at 12:01
  • related slightly - I used this info to add 'onenote:' into the comma seperated list. It might be worth pasting the default code as an example so people can see what section to look for and how it is formatted, and how to add one in
    – Smock
    Commented Nov 13 at 10:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.