Checking if an arbitrary (remote) URL is a file attachment, and extracting it if it is? [Answered]
If I'm given an arbitrary URL (I don't have control over it), how can I check if it appears to be a direct link to a file, and if it is, extract the filename + extension? It's been a little while so I don't remember why I stopped using it, but I tried using
Path.GetFileName() and it didn't work correctly all of the time. IIRC, it would preserve any garbage data like query parameters after the end of the filename, so instead of http://example.com/image.png?width=420&height=69 producing image.png, it would produce image.png?width=420&height=69? It's been a hot second so I don't remember if this was the exact problem.