Skip to content

OSError: [Errno 36] File name too long #451

Closed

Description

@slavaGanzin

Httpie fails on too long filenames (but works fine with -o filename), wget shortens them automatically.

Thanks for your work, httpie is great!

http --version
0.9.3

$ http -d https://camo.githubusercontent.com/810bdde0a88bc3f8ce70c5d85d8537c37f707abe/68747470733a2f2f75706c6f61642e77696b696d656469612e6f72672f77696b6970656469612f636f6d6d6f6e732f7468756d622f652f65632f4d6f6e615f4c6973612c5f62795f4c656f6e6172646f5f64615f56696e63692c5f66726f6d5f4332524d465f7265746f75636865642e6a70672f36383770782d4d6f6e615f4c6973612c5f62795f4c656f6e6172646f5f64615f56696e63692c5f66726f6d5f4332524d465f7265746f75636865642e6a7067

Traceback (most recent call last):
  File "/usr/bin/http", line 9, in <module>
    load_entry_point('httpie==0.9.3', 'console_scripts', 'http')()
  File "/usr/lib/python3.5/site-packages/httpie/core.py", line 149, in main
    download_stream, download_to = download.start(response)
  File "/usr/lib/python3.5/site-packages/httpie/downloads.py", line 235, in start
    self._output_file = open(get_unique_filename(filename), mode='a+b')
http: error: OSError: [Errno 36] File name too long: '68747470733a2f2f75706c6f61642e77696b696d656469612e6f72672f77696b6970656469612f636f6d6d6f6e732f7468756d622f652f65632f4d6f6e615f4c6973612c5f62795f4c656f6e6172646f5f64615f56696e63692c5f66726f6d5f4332524d465f7265746f75636865642e6a70672f36383770782d4d6f6e615f4c6973612c5f62795f4c656f6e6172646f5f64615f56696e63692c5f66726f6d5f4332524d465f7265746f75636865642e6a7067.jpe'
wget https://camo.githubusercontent.com/810bdde0a88bc3f8ce70c5d85d8537c37f707abe/68747470733a2f2f75706c6f61642e77696b696d656469612e6f72672f77696b6970656469612f636f6d6d6f6e732f7468756d622f652f65632f4d6f6e615f4c6973612c5f62795f4c656f6e6172646f5f64615f56696e63692c5f66726f6d5f4332524d465f7265746f75636865642e6a70672f36383770782d4d6f6e615f4c6973612c5f62795f4c656f6e6172646f5f64615f56696e63692c5f66726f6d5f4332524d465f7265746f75636865642e6a7067
The name is too long, 358 chars total.
Trying to shorten...

New name is 68747470733a2f2f75706c6f61642e77696b696d656469612e6f72672f77696b6970656469612f636f6d6d6f6e732f7468756d622f652f65632f4d6f6e615f4c6973612c5f62795f4c656f6e6172646f5f64615f56696e63692c5f66726f6d5f4332524d465f7265746f75636865642e6a70672f3638.

Activity

  1. jkbrzt commented on Mar 17, 2016

    @jkbrzt
    Member

    @slavaGanzin Fixed, thanks for the report! You can test it by installing HTTPie from master until it gets released:

    pip install --upgrade https://github.com/jkbrzt/httpie/archive/master.tar.gz
  2. slavaGanzin commented on Mar 17, 2016

    @slavaGanzin
    Author

    @jkbrzt 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions