2 ms·
> I thought about a possible fix for a while, but in the end decided that the quickest and easiest fix would be to adjust the regular expressio ..... WHAT? Py
by fake-name 9y ago
> I thought about a possible fix for a while, but in the end decided that the quickest and easiest fix would be to adjust the regular expressio
..... WHAT?
Python has a suite of facilities exactly for this very kind of problem.
Literally, the solution is "os.path.abspath(filename).startswith(os.path.abspath(dlfolder))"
This should, in all cases, return true if the filename is within the download folder directory, and false for any other case.
- jwilk 9y agoIt doesn't do the right thing if dlfolder doesn't end with a slash.