Should filename be escape()'d here like it is in the curl command?