For anyone else using windows. There was another small issue.

This line in views.py:

# CREATE FILEOBJECT
        url_path = "/".join([s.strip("/") for s in
                            [get_directory(), path, file] if s.strip("/")])
        
Changed it to:

# CREATE FILEOBJECT
        url_path = "/".join([s.strip("/") for s in
                            [get_directory(), path.replace("\\", "/"), 
file] if s.strip("/")])
        

This might not be the best way to solve the problem but if you just want to 
get it working on windows it does seem to do the trick.



On Tuesday, February 13, 2018 at 8:28:42 AM UTC, Simon Bradley wrote:
>
> Will do.
>
> On Monday, February 12, 2018 at 10:28:00 PM UTC, Stephen McDonald wrote:
>>
>> Could you create a pull request with your fix? That'd be great, thank you.
>>
>> On Tue, Feb 13, 2018 at 7:14 AM, Simon Bradley <captain...@gmail.com> 
>> wrote:
>>
>>> OK def fixed it now
>>>
>>> This line in the views.py of filebrowser-safe:
>>>
>>> if not normalized.startswith(get_directory()) or ".." in normalized:
>>>        
>>> It appears to be the problem.
>>>
>>> I changed it to:
>>>
>>> if not normalized.startswith(get_directory().strip("/")) or ".." in 
>>> normalized:
>>>        
>>> Removed the FILEBROWSER_DIRECTORY entry from the local_settings.py 
>>> because i generally stick with the default path anyway.
>>>
>>> Tested everything. Looks like it's working. I know there was a bit of a 
>>> false alarm before but this time i'm fairly sure.
>>>
>>> If there's a simpler way to get around this though i'd like to know it.
>>>
>>> It's a bit of a faff having to have my own version of filebrowser-safe 
>>> for every mez proj.
>>>
>>>
>>>
>>>
>>>
>>> On Monday, February 12, 2018 at 7:54:20 PM UTC, Simon Bradley wrote:
>>>>
>>>> Ahhhhhhhh!
>>>>
>>>> Now i can't navigate in the media library.
>>>>
>>>> LOL!
>>>>
>>>> Still. Bound to be able to figure it out from here!
>>>>
>>>> On Monday, February 12, 2018 at 7:47:15 PM UTC, Simon Bradley wrote:
>>>>>
>>>>> Also, thanks to Mathias.
>>>>>
>>>>> It was your advice that led me to it.
>>>>>
>>>>> - Uninstalled filebrowser-safe
>>>>> - Cloned a fresh one from the repo
>>>>> - did setup.py develop
>>>>> - fiddled with the messages from delete
>>>>> - found said problem
>>>>>
>>>>>
>>>>> On Monday, February 12, 2018 at 7:43:46 PM UTC, Simon Bradley wrote:
>>>>>>
>>>>>> Well i found the problem.
>>>>>>
>>>>>> Very silly. Silly windows user.
>>>>>>
>>>>>> filebrowser-safe get_directory() picks up the directory from 
>>>>>> settings.py or the default 'uploads/' and it's as simple as that it 
>>>>>> seams.
>>>>>>
>>>>>> Because for it to work on windows the path needs to be 'uploads\'
>>>>>>
>>>>>> A backslash. That's it.
>>>>>>
>>>>>> So i just added this:
>>>>>>
>>>>>> FILEBROWSER_DIRECTORY = 'uploads\\'
>>>>>>
>>>>>> To my local_settings.py and now we're good.
>>>>>>
>>>>>> Hope this helps some people.
>>>>>>
>>>>>>
>>>>>> On Saturday, February 10, 2018 at 7:12:02 PM UTC, Simon Bradley wrote:
>>>>>>>
>>>>>>> Yo!
>>>>>>>
>>>>>>> Does anyone have any idea about this? Googling it seems to suggest 
>>>>>>> it has lingered for several years. It's a real annoyance because 
>>>>>>> overall i 
>>>>>>> really like mezzanine and have developed a couple of sites with it now. 
>>>>>>> I'm 
>>>>>>> also using windows 10 and everything else works great.
>>>>>>>
>>>>>>> Would be great if i had any kind of workaround for this.
>>>>>>>
>>>>>>> Anyone any idea?
>>>>>>>
>>>>>>> Anyone at all?
>>>>>>>
>>>>>>> I mean i spent a fair amount of time fiddling with it. Looking here: 
>>>>>>> https://docs.python.org/3/library/os.html
>>>>>>>
>>>>>>> It says this: 
>>>>>>> Although Windows supports chmod() 
>>>>>>> <https://docs.python.org/3/library/os.html#os.chmod>, you can only 
>>>>>>> set the file’s read-only flag with it (via the stat.S_IWRITE and 
>>>>>>> stat.S_IREADconstants or a corresponding integer value). All other 
>>>>>>> bits are ignored.
>>>>>>>
>>>>>>> Now i'm not really all that knowledgeable in this area but is that 
>>>>>>> saying that because Mezzanine uses chmod that you can't actually change 
>>>>>>> the 
>>>>>>> file permissions on windows through mezzanine?
>>>>>>>
>>>>>>> If so could there be another way? Maybe changing the file 
>>>>>>> permissions in windows explorer somehow?
>>>>>>>
>>>>>>> Welcome a discussion here folks. I know someone out there knows more 
>>>>>>> about this than i do. In fact i suspect their number may be legion.
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> On Wednesday, November 29, 2017 at 8:42:17 PM UTC, Alexander Yang 
>>>>>>> wrote:
>>>>>>>>
>>>>>>>> Hi. I'm trying Mezzanine on Windows 10 and facing this same issue. 
>>>>>>>> I can't delete images from the media library in the admin interface. 
>>>>>>>> Same 
>>>>>>>> error message. Did you manage to solve this?
>>>>>>>>
>>>>>>>> Thanks,
>>>>>>>>
>>>>>>>> Alex
>>>>>>>>
>>>>>>>>
>>>>>>>> On Friday, 27 March 2015 02:41:22 UTC+1, Wan Hsin Mao wrote:
>>>>>>>>>
>>>>>>>>> I'm using the newest version of Mezzanine as my website CMS. There 
>>>>>>>>> is always "An error occurred" message after  I click the trash 
>>>>>>>>> can icon. Is there any way to find out what's going wrong or anything 
>>>>>>>>> suggested that I can check to solve this error?
>>>>>>>>>
>>>>>>>>> p.s. I just want to delete the .ppt file in admin page.
>>>>>>>>>
>>>>>>>> -- 
>>> You received this message because you are subscribed to the Google 
>>> Groups "Mezzanine Users" group.
>>> To unsubscribe from this group and stop receiving emails from it, send 
>>> an email to mezzanine-use...@googlegroups.com.
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>>
>>
>>
>> -- 
>> Stephen McDonald
>> http://jupo.org
>>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Mezzanine Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to mezzanine-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to