Skip to content

Commit

Permalink
tries fixing #18
Browse files Browse the repository at this point in the history
  • Loading branch information
WolfgangFahl committed Mar 14, 2021
1 parent 9f72ccc commit 86dc3c3
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
2 changes: 1 addition & 1 deletion frontend/wikicms.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ def needsProxy(self,path:str)->bool:
Returns:
True if this path needs to be proxied
'''
result=path.startswith("/images")
result=path.startswith("/images/")
return result

def proxy(self,path:str)->str:
Expand Down
13 changes: 13 additions & 0 deletions tests/test_frontend.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,19 @@ def testProxy(self):
self.assertEqual("200 OK",imageResponse.status)
self.assertEqual(79499,len(imageResponse.data))

def testIssue18(self):
'''
https://github.com/BITPlan/pyWikiCMS/issues/18
image proxying should work #18
'''
frontend=self.server.enableFrontend('www')
url="/images/wiki/thumb/4/42/1738-006.jpg/400px-1738-006.jpg"
self.assertTrue(frontend.needsProxy(url))
imageResponse=frontend.render(url)
self.assertFalse(imageResponse is None)
self.assertEqual("200 OK",imageResponse.status)
self.assertEqual(33742,len(imageResponse.data))

def createPackage(self,packageFolder,templateFolder,moduleName,moduleCode,templateCode):
moduleFolder="%s/%s" % (packageFolder,moduleName)
os.makedirs(moduleFolder,exist_ok=True)
Expand Down

0 comments on commit 86dc3c3

Please sign in to comment.