Skip to content
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

File name too long #19

Open
schmir opened this issue Jun 28, 2012 · 1 comment
Open

File name too long #19

schmir opened this issue Jun 28, 2012 · 1 comment

Comments

@schmir
Copy link
Contributor

schmir commented Jun 28, 2012

got the following traceback today:

  File "/home/pp/local/lib/python2.6/site-packages/gevent/greenlet.py", line 327, in run
    result = self._run(*self.args, **self.kwargs)
  File "/home/pp/local/lib/python2.6/site-packages/mwlib/net/fetch.py", line 204, in download_to_file
    out = open(temp_path, "wb")
IOError: [Errno 36] File name too long: '/home/pp/sandbox/cache/fc/fc05cf45aeb81b18/tmpV2C4gb/nuwiki/images/~1662~~1585~~1608~~1606~~1583~~1607~:~1585~~1575~~1740~~8204~~1607~~1575~~1740~ ~1605~~1608~~1587~~1608~~1740~ ~1585~~1740~~1575~~1587~~1578~~8204~~1580~~1605~~1607~~1608~~1585~~1740~ ~1583~~1607~~1605~ ~1575~~1740~~1585~~1575~~1606~ ~1576~~1575~ ~1581~~1583~~1608~~1583~ ~1583~~1585~~1589~~1583~ ~1583~~1585~ ~1575~~1587~~1578~~1575~~1606~~8204~~1607~~1575~.png\xc2\xb7'
@Rielin29
Copy link

Had to hunt this problem on my company's private wiki.
Cutting long story short - this comes from the utils' fsescape function. Fetch.py uses that to make image file names. And there you see it's six chars for anything other than ascii - means one's allowed around 40 chars in the unicode image name (to fit into 255 chars in filename). As a quick and dirty fix I've changed fsescape to:

no_slash = s.replace("/", "__")
no_backslash = s.replace("\\", "__")
return no_backslash

Which likely won't work in a non-unicode enabled environment and may have other problems, but at least works for my Debian setup so far.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants