rochimensi / MSImages

1 stars 0 forks source link

Renaming files across partitions fails #61

Open AlphaGit opened 9 years ago

AlphaGit commented 9 years ago

NodeJS fs module will basically execute a rename operation on fs.rename, which will fail if the origin and destiny paths are on different partitions.

This happened to me while testing in my Windows environment: my code is under the D:\ partition, while my temporary directory (which is treated as the server's tmp directory) was under C:\.

Consider a fallback to copying and deleting the file for these cases.

Visible symptom

  1. Run the code from partition D:, have your user's temporal directory in partition C:
  2. Try to upload an image
  3. The server will return an error like the following (with status 200) image
  4. The image will not get uploaded

    References