MIT-LCP / physionet-build

The new PhysioNet platform.
https://physionet.org/
BSD 3-Clause "New" or "Revised" License
56 stars 20 forks source link

http requests to display a file raise an OSError error if the file name is too long #1093

Closed tompollard closed 4 years ago

tompollard commented 4 years ago

http requests to display a file raise an OSError error if the file name is too long (OSError: [Errno 63] File name too long). This should only happen if the request is incorrectly specified. e.g:

/content/gaitpdb/1.0.0/.+This+database+is+the+most+widely+recognized+database+of+the+electromyograms+used+in+the+biomedical+signal+processing+community.+In+particular,+it+contains+the+measures+of+the+gaits+of+93+patients+with+the+idiopathic+Parkinson%E2%80%99s+disease+and+73+healthy+controls.+Here,+the+mean+of+the+ages+of+the+subjects+with+the+Parkinson%E2%80%99s+disease+is+66.3+years+old+in+which+63%25+of+these+subjects+are+men.+On+the+other+hand,+the+mean+of+the+ages+of+the+healthy+subjects+are+66.3+years+in+which+55%25+of+these+subjects+are+men.+In+this+paper,+15+electromyograms+are+randomly+chosen.+In+particular,+there+are+15+electromyograms+in+which+10+of+them+are+from+the+healthy+subjects+and+5+of+them+are+from+the+subjects+with+the+Parkinson%E2%80%99s+disease.

I assume we can just catch the error and raise a 404.

Traceback:

Request Method: GET
Request URL: http://localhost:8000/content/gaitpdb/1.0.0/.+This+database+is+the+most+widely+recognized+database+of+the+electromyograms+used+in+the+biomedical+signal+processing+community.+In+particular,+it+contains+the+measures+of+the+gaits+of+93+patients+with+the+idiopathic+Parkinson%E2%80%99s+disease+and+73+healthy+controls.+Here,+the+mean+of+the+ages+of+the+subjects+with+the+Parkinson%E2%80%99s+disease+is+66.3+years+old+in+which+63%25+of+these+subjects+are+men.+On+the+other+hand,+the+mean+of+the+ages+of+the+healthy+subjects+are+66.3+years+in+which+55%25+of+these+subjects+are+men.+In+this+paper,+15+electromyograms+are+randomly+chosen.+In+particular,+there+are+15+electromyograms+in+which+10+of+them+are+from+the+healthy+subjects+and+5+of+them+are+from+the+subjects+with+the+Parkinson%E2%80%99s+diseasecontent/gaitpdb/1.0.0/.+This+database+is+the+most+widely+recognized+database+of+the+electromyograms+used+in+the+biomedical+signal+processing+community.+In+particular,+it+contains+the+measures+of+the+gaits+of+93+patients+with+the+idiopathic+Parkinson%E2%80%99s+disease+and+73+healthy+controls.+Here,+the+mean+of+the+ages+of+the+subjects+with+the+Parkinson%E2%80%99s+disease+is+66.3+years+old+in+which+63%25+of+these+subjects+are+men.+On+the+other+hand,+the+mean+of+the+ages+of+the+healthy+subjects+are+66.3+years+in+which+55%25+of+these+subjects+are+men.+In+this+paper,+15+electromyograms+are+randomly+chosen.+In+particular,+there+are+15+electromyograms+in+which+10+of+them+are+from+the+healthy+subjects+and+5+of+them+are+from+the+subjects+with+the+Parkinson%E2%80%99s+disease.content/gaitpdb/1.0.0/.+This+database+is+the+most+widely+recognized+database+of+the+electromyograms+used+in+the+biomedical+signal+processing+community.+In+particular,+it+contains+the+measures+of+the+gaits+of+93+patients+with+the+idiopathic+Parkinson%E2%80%99s+disease+and+73+healthy+controls.+Here,+the+mean+of+the+ages+of+the+subjects+with+the+Parkinson%E2%80%99s+disease+is+66.3+years+old+in+which+63%25+of+these+subjects+are+men.+On+the+other+hand,+the+mean+of+the+ages+of+the+healthy+subjects+are+66.3+years+in+which+55%25+of+these+subjects+are+men.+In+this+paper,+15+electromyograms+are+randomly+chosen.+In+particular,+there+are+15+electromyograms+in+which+10+of+them+are+from+the+healthy+subjects+and+5+of+them+are+from+the+subjects+with+the+Parkinson%E2%80%99s+disease.content/gaitpdb/1.0.0/.+This+database+is+the+most+widely+recognized+database+of+the+electromyograms+used+in+the+biomedical+signal+processing+community.+In+particular,+it+contains+the+measures+of+the+gaits+of+93+patients+with+the+idiopathic+Parkinson%E2%80%99s+disease+and+73+healthy+controls.+Here,+the+mean+of+the+ages+of+the+subjects+with+the+Parkinson%E2%80%99s+disease+is+66.3+years+old+in+which+63%25+of+these+subjects+are+men.+On+the+other+hand,+the+mean+of+the+ages+of+the+healthy+subjects+are+66.3+years+in+which+55%25+of+these+subjects+are+men.+In+this+paper,+15+electromyograms+are+randomly+chosen.+In+particular,+there+are+15+electromyograms+in+which+10+of+them+are+from+the+healthy+subjects+and+5+of+them+are+from+the+subjects+with+the+Parkinson%E2%80%99s+disease.

Traceback:

File "/Users/tompollard/projects/physionet-build/env/lib/python3.7/site-packages/django/core/handlers/exception.py" in inner
  34.             response = get_response(request)

File "/Users/tompollard/projects/physionet-build/env/lib/python3.7/site-packages/django/core/handlers/base.py" in _get_response
  115.                 response = self.process_exception_by_middleware(e, request)

File "/Users/tompollard/projects/physionet-build/env/lib/python3.7/site-packages/django/core/handlers/base.py" in _get_response
  113.                 response = wrapped_callback(request, *callback_args, **callback_kwargs)

File "/Users/tompollard/projects/physionet-build/physionet-django/project/views.py" in display_published_project_file
  1455.         return display_project_file(request, project, full_file_name)

File "/Users/tompollard/projects/physionet-build/physionet-django/project/fileviews/main.py" in display_project_file
  36.         infile = open(abs_path, 'rb')

Exception Type: OSError at /content/gaitpdb/1.0.0/.+This+database+is+the+most+widely+recognized+database+of+the+electromyograms+used+in+the+biomedical+signal+processing+community.+In+particular,+it+contains+the+measures+of+the+gaits+of+93+patients+with+the+idiopathic+Parkinson’s+disease+and+73+healthy+controls.+Here,+the+mean+of+the+ages+of+the+subjects+with+the+Parkinson’s+disease+is+66.3+years+old+in+which+63%+of+these+subjects+are+men.+On+the+other+hand,+the+mean+of+the+ages+of+the+healthy+subjects+are+66.3+years+in+which+55%+of+these+subjects+are+men.+In+this+paper,+15+electromyograms+are+randomly+chosen.+In+particular,+there+are+15+electromyograms+in+which+10+of+them+are+from+the+healthy+subjects+and+5+of+them+are+from+the+subjects+with+the+Parkinson’s+diseasecontent/gaitpdb/1.0.0/.+This+database+is+the+most+widely+recognized+database+of+the+electromyograms+used+in+the+biomedical+signal+processing+community.+In+particular,+it+contains+the+measures+of+the+gaits+of+93+patients+with+the+idiopathic+Parkinson’s+disease+and+73+healthy+controls.+Here,+the+mean+of+the+ages+of+the+subjects+with+the+Parkinson’s+disease+is+66.3+years+old+in+which+63%+of+these+subjects+are+men.+On+the+other+hand,+the+mean+of+the+ages+of+the+healthy+subjects+are+66.3+years+in+which+55%+of+these+subjects+are+men.+In+this+paper,+15+electromyograms+are+randomly+chosen.+In+particular,+there+are+15+electromyograms+in+which+10+of+them+are+from+the+healthy+subjects+and+5+of+them+are+from+the+subjects+with+the+Parkinson’s+disease.content/gaitpdb/1.0.0/.+This+database+is+the+most+widely+recognized+database+of+the+electromyograms+used+in+the+biomedical+signal+processing+community.+In+particular,+it+contains+the+measures+of+the+gaits+of+93+patients+with+the+idiopathic+Parkinson’s+disease+and+73+healthy+controls.+Here,+the+mean+of+the+ages+of+the+subjects+with+the+Parkinson’s+disease+is+66.3+years+old+in+which+63%+of+these+subjects+are+men.+On+the+other+hand,+the+mean+of+the+ages+of+the+healthy+subjects+are+66.3+years+in+which+55%+of+these+subjects+are+men.+In+this+paper,+15+electromyograms+are+randomly+chosen.+In+particular,+there+are+15+electromyograms+in+which+10+of+them+are+from+the+healthy+subjects+and+5+of+them+are+from+the+subjects+with+the+Parkinson’s+disease.content/gaitpdb/1.0.0/.+This+database+is+the+most+widely+recognized+database+of+the+electromyograms+used+in+the+biomedical+signal+processing+community.+In+particular,+it+contains+the+measures+of+the+gaits+of+93+patients+with+the+idiopathic+Parkinson’s+disease+and+73+healthy+controls.+Here,+the+mean+of+the+ages+of+the+subjects+with+the+Parkinson’s+disease+is+66.3+years+old+in+which+63%+of+these+subjects+are+men.+On+the+other+hand,+the+mean+of+the+ages+of+the+healthy+subjects+are+66.3+years+in+which+55%+of+these+subjects+are+men.+In+this+paper,+15+electromyograms+are+randomly+chosen.+In+particular,+there+are+15+electromyograms+in+which+10+of+them+are+from+the+healthy+subjects+and+5+of+them+are+from+the+subjects+with+the+Parkinson’s+disease.
Exception Value: [Errno 63] File name too long: '/Users/tompollard/projects/physionet-build/physionet-django/static/published-projects/gaitpdb/1.0.0/.+This+database+is+the+most+widely+recognized+database+of+the+electromyograms+used+in+the+biomedical+signal+processing+community.+In+particular,+it+contains+the+measures+of+the+gaits+of+93+patients+with+the+idiopathic+Parkinson’s+disease+and+73+healthy+controls.+Here,+the+mean+of+the+ages+of+the+subjects+with+the+Parkinson’s+disease+is+66.3+years+old+in+which+63%+of+these+subjects+are+men.+On+the+other+hand,+the+mean+of+the+ages+of+the+healthy+subjects+are+66.3+years+in+which+55%+of+these+subjects+are+men.+In+this+paper,+15+electromyograms+are+randomly+chosen.+In+particular,+there+are+15+electromyograms+in+which+10+of+them+are+from+the+healthy+subjects+and+5+of+them+are+from+the+subjects+with+the+Parkinson’s+diseasecontent/gaitpdb/1.0.0/.+This+database+is+the+most+widely+recognized+database+of+the+electromyograms+used+in+the+biomedical+signal+processing+community.+In+particular,+it+contains+the+measures+of+the+gaits+of+93+patients+with+the+idiopathic+Parkinson’s+disease+and+73+healthy+controls.+Here,+the+mean+of+the+ages+of+the+subjects+with+the+Parkinson’s+disease+is+66.3+years+old+in+which+63%+of+these+subjects+are+men.+On+the+other+hand,+the+mean+of+the+ages+of+the+healthy+subjects+are+66.3+years+in+which+55%+of+these+subjects+are+men.+In+this+paper,+15+electromyograms+are+randomly+chosen.+In+particular,+there+are+15+electromyograms+in+which+10+of+them+are+from+the+healthy+subjects+and+5+of+them+are+from+the+subjects+with+the+Parkinson’s+disease.content/gaitpdb/1.0.0/.+This+database+is+the+most+widely+recognized+database+of+the+electromyograms+used+in+the+biomedical+signal+processing+community.+In+particular,+it+contains+the+measures+of+the+gaits+of+93+patients+with+the+idiopathic+Parkinson’s+disease+and+73+healthy+controls.+Here,+the+mean+of+the+ages+of+the+subjects+with+the+Parkinson’s+disease+is+66.3+years+old+in+which+63%+of+these+subjects+are+men.+On+the+other+hand,+the+mean+of+the+ages+of+the+healthy+subjects+are+66.3+years+in+which+55%+of+these+subjects+are+men.+In+this+paper,+15+electromyograms+are+randomly+chosen.+In+particular,+there+are+15+electromyograms+in+which+10+of+them+are+from+the+healthy+subjects+and+5+of+them+are+from+the+subjects+with+the+Parkinson’s+disease.content/gaitpdb/1.0.0/.+This+database+is+the+most+widely+recognized+database+of+the+electromyograms+used+in+the+biomedical+signal+processing+community.+In+particular,+it+contains+the+measures+of+the+gaits+of+93+patients+with+the+idiopathic+Parkinson’s+disease+and+73+healthy+controls.+Here,+the+mean+of+the+ages+of+the+subjects+with+the+Parkinson’s+disease+is+66.3+years+old+in+which+63%+of+these+subjects+are+men.+On+the+other+hand,+the+mean+of+the+ages+of+the+healthy+subjects+are+66.3+years+in+which+55%+of+these+subjects+are+men.+In+this+paper,+15+electromyograms+are+randomly+chosen.+In+particular,+there+are+15+electromyograms+in+which+10+of+them+are+from+the+healthy+subjects+and+5+of+them+are+from+the+subjects+with+the+Parkinson’s+disease.'
bemoody commented 4 years ago

Thanks for chasing this down!

If the errno value is not recognized here then we should re-raise the original OSError.

tompollard commented 4 years ago

Fixed in https://github.com/MIT-LCP/physionet-build/pull/1094