axios: Axios 0.27.1 has a pretty serious problem

Describe the bug

There are some people whose production environment is using the CDN introduction。 Using jsDelivr CDN:<script src="https://cdn.jsdelivr.net/npm/axios/dist/axios.min.js"></script> Using unpkg CDN:<script src="https://unpkg.com/axios/dist/axios.min.js"></script>

To Reproduce

Many people will use the image upload function.Just today, Axios has been upgraded to version 0.27.1. As a result, pictures in our production environment cannot be uploaded and used. I think this will affect more people, which should be a big problem!

uploadSpecsValueImgChange() {
  let inputDOM = this.$refs.inputer;
  let file = inputDOM.files[0]; 
  let size = Math.floor(file.size / 1024);
  let formData = new FormData();
  formData.append("file", file); 
  var that = this;
  var index0 = this.specsValueImgIndex0;
  var index1 = this.specsValueImgIndex1;
  axios.post('/api/Upload/one', formData)
	  .then(function(res) {
		  console.log(res.data);
		  if (res.data.code != 0) {
			  layer.msg(res.data.msg);
			  return false;
		  }
  
		  if (index1 >= 0) {
			  that.specsList[index0]['values'][index1]['image'] = res.data.data.file
		  } else {
			  that.specsList[index0]['new_image'] = res.data.data.file
		  }
	  })
	  .catch(function(error) {
		  // console.log(error);
	  });
}

Expected behavior

Hope it can be repaired soon.

Environment

  • Axios Version [e.g. 0.27.1]
  • Adapter [e.g. XHR/HTTP]
  • Browser [e.g. Chrome, Safari]
  • Browser Version [e.g. 22]
  • Node.js Version [e.g. 13.0.1]

Additional context/Screenshots

Refer to the sample code and simulate submitting images to see this problem

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Reactions: 9
  • Comments: 17 (4 by maintainers)

Most upvoted comments

Looks like someone pushed test build

For my college project I needed to upload a file. I found some article that explains how to do that in Vue and I had literally struggled for 5 hours straight with this piece of crap bug to just find out that the authors app used an old version of axios which didn’t include this pathetic bug which should never had been introduced, ever…

I think I’m done with axios for a few years.

At the time of writing this is axios 0.27.1 (latest)

If you encounter similar problems, please first use the CDN of the previous version to ensure normal production environment
<script src="https://unpkg.com/axios@0.27.0/dist/axios.min.js"></script>

No problems, it was due to some changes I released. We will do better next release.