I'm not sure precisely what's happening in -filenameForURLString:, but the handling of the port number substring is broken. The existing regex is invalid (there are two repetition specifiers, when only one is permitted). But when I fixed it (removing the "?"), it caused the hostname and the first element of the path to squeeze together.
Simply ripping out the port is probably a bad idea. It might be better to replace the colon with an underscore. I'm going to try that myself.
Can you post an example of a broken URL?
I modified it to output "localhost_3000/blah"
won't happen anymore since filenames are hashes now