pyhton3 flask hangs on file changes using send_from_directory

Bug #1528316 reported by Benjamin Baez
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
flask (Ubuntu)
Fix Released
Undecided
Unassigned

Bug Description

I was getting an exception randomly on minetest master-server that I traced back to "send_from_directory". When I searched on the web I found the problem was already reported and resolved a few years back.

Similar Error
https://github.com/mitsuhiko/flask/issues/1169

Bug Fix:
https://github.com/mitsuhiko/flask/pull/921

Please update the package with bug fix reported above.

Thank you!

Summary of issue from a user on GitHub:

welshjf commented on May 1
I've hit this problem too; perhaps I can clarify what's going on.
send_from_directory tests for existence based on the safe_join of directory and filename. So if directory is relative, this is relative to the current working directory of the process -- pretty unreliable. send_file, however, expands relative paths based on current_app.root_path, and does not have any existence check.
Thus, if the CWD and root_path do not match, send_from_directory may prematurely raise a 404 for files that do exist, or fail to do so for files that happen to exist in the CWD but not the root_path. In the second case, you get a 500 internal error when os.path.getsize or

ProblemType: Bug
DistroRelease: Ubuntu 14.04
Package: python3-flask (not installed)
ProcVersionSignature: Ubuntu 3.19.0-25.26~14.04.1-generic 3.19.8-ckt2
Uname: Linux 3.19.0-25-generic i686
ApportVersion: 2.14.1-0ubuntu3.19
Architecture: i386
Date: Mon Dec 21 10:20:51 2015
InstallationDate: Installed on 2015-12-09 (12 days ago)
InstallationMedia: Ubuntu-Server 14.04.3 LTS "Trusty Tahr" - Beta i386 (20150805)
ProcEnviron:
 TERM=xterm
 PATH=(custom, no user)
 LANG=en_US.UTF-8
 SHELL=/bin/bash
SourcePackage: flask
UpgradeStatus: No upgrade log present (probably fresh install)

Chuck Short (zulcss)
Changed in flask (Ubuntu):
status: New → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.