-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Pathname may not contain double slash “//” when using UNC notation with IIS #801
Comments
I don't have a way to debug this as I don't work on IIS and PW doesn't officially support it. Though happy to try and resolve it still but probably need someone else to debug this one. Do you have any idea where the double slashes are in the path? PW disallows them as a matter of security because paths with double slashes can potentially mimic streams or schemes in some cases. You mentioned UNC notation, which I'm not familiar with—does that imply double slashes somewhere? |
There's a bit more explanation in the forum post I made about this issue - matjazp had some explanation as to why it is happening. Prior to version 3.0.118 I have not had this issue arise with any other site that uses the same type of config in IIS (going back 5 or so years building ProcessWire sites) Issue appears after I upgraded to 3.0.123 from 3.0.114 - Falling back to 3.0.114 everything is ok. |
Microsoft Windows (not IIS per se) uses the following types of paths:
UNC, short for Universal Naming Convention or Uniform Naming Convention, specifies a common syntax to describe the location of a network resource, such as a shared file, directory, or printer. The (short) UNC syntax for Windows systems has the generic form:
and that can be used as the home directory folder in the applications and in IIS settings. For example, if you have a server with a name of "myserver" and a share on that server, named "myshare", you can set this as a home (root) folder for the PW installation and then a path to the templates folder is:
Starting with 3.0.118 (or somewhere around that version), backward slashes are replaced with forward slashes and the path becomes:
throwing WireException in allowPath() method in WireFileTools.php |
@matjazpotocnik Thanks for the info, very helpful. I added that double slash check as a safety measure, but it seems like we could let it through if the same slashes appear in a known safe path like Matjaz or @paulsivers I'm curious if on a system using this UNC format, what does |
@ryancramerdesign Outputting $config->paths->assets in my local dev site gives //ALPHA/DEVELOPMENT/NOL Network/Website/site/assets/ Hope this helps. |
@paulsivers for a good measure, please also provide $config->paths->root |
$config->paths->root outputs as //ALPHA/DEVELOPMENT/NOL Network/Website/ |
@paulsivers @matjazpotocnik Thanks, I think it should be easy for us to work around this then. I've pushed an update that I think will fix it, though please let me know if not. |
@paulsivers could you test this fix?
|
@matjazpotocnik I don't know for sure without having a test environment, but I don't see anywhere that we are filtering for that, so chances are it would work. |
@ryancramerdesign @matjazpotocnik Have updated my site to latest dev and all seems ok now. Many thanks ! |
@paulsivers If this issue is fixed to your satisfaction, please go ahead and close this issue. You can re-open it later if you need to. Thank you. |
Short description of the issue
Getting error stating - pathname may not contain double slash “//”
Possibly with allowPath() method in WireFileTools.php
This seems to be throwing an exception when using UNC notation for pathnames (In an IIS7 / Share on NAS box environment)
After upgrading two development sites from version 3.0.114 to the now Master 3.0.123, I am encountering issues with image uploads / resizing when trying to add images or after executing some code to set a new width on existing images that are output as thumbnails within a slideshow thumbnail navigation.
If I revert back to my previous version of the 'wire' directory, all is ok.
I am running IIS7 on a Windows Server (for development) with files residing on a NAS box on the network - Sites in IIS7 are mapped to the NAS box network name ie. \ALPHA\Development.... and IP address/port number combinations used to view the sites - this is the development set up that has been running for a number of years and currently runs over 20 ProcessWire sites with no issues (certainly up to version 3.0.114)
Two of the errors I get are:
pathname may not contain double slash “//” (in \ALPHA\DEVELOPMENT\NOL Network\Website\wire\modules\Inputfield\InputfieldFile\InputfieldFile.module line 791)
The above is when adding an image to a page in Admin.
and ...
Error: Exception: pathname may not contain double slash “//” (in \ALPHA\DEVELOPMENT\NOL Network\Website\wire\core\WireFileTools.php line 486) #0 \ALPHA\DEVELOPMENT\NOL Network\Website\wire\core\WireFileTools.php(821): ProcessWire\WireFileTools->allowPath('//ALPHA/DEVELOP...', false, true) #1 \ALPHA\DEVELOPMENT\NOL Network\Website\wire\core\WireTempDir.php(353): ProcessWire\WireFileTools->filePutContents('//ALPHA/DEVELOP...', 1548003024) #2 \ALPHA\DEVELOPMENT\NOL Network\Website\wire\core\WireTempDir.php(164): ProcessWire\WireTempDir->mkdir('//ALPHA/DEVELOP...', true) #3 \ALPHA\DEVELOPMENT\NOL Network\Website\wire\core\PagefilesManager.php(623): ProcessWire\WireTempDir->get() #4 \ALPHA\DEVELOPMENT\NOL Network\Website\wire\core\Pageimage.php(703): ProcessWire\PagefilesManager->getTempPath() #5 \ALPHA\DEVELOPMENT\NOL Network\Website\wire\core\Pageimage.php(552): ProcessWire\Pageimage->___size(100, 0, Array) #6 \ALPHA\DEVELOPMENT\NOL Network\Website\wire\core\Pageimage.php(865): ProcessWire\Pageimage->size(
when an existing image is trying to resize on the fly after changing code to display images with a defined width.
I noticed that in WireFileTools.php there is a reference on line 414 in the notes near to where this error occurs that says '@SInCE 3.0.118'
It has been suggested in a reply to a forum post about this issue that the solution would be not to use UNC notation but rather map a drive to the share and use a drive letter. Have tried this but cannot configure IIS site to use mapped drive (also read that IIS should in fact use UNC notation)
Setup/Environment
ProcessWire 3.0.123
IIS7
PHP 5.6
The text was updated successfully, but these errors were encountered: