Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

file upload fails and creates two "successful" json fields for hidden input #3038

Open
birthdaycorp opened this issue Jul 22, 2021 · 4 comments
Assignees
Labels

Comments

@birthdaycorp
Copy link

When the file upload fails and I try to upload the file a second time, the json encoded string that gets inserted has one empty successful field, one failed field, and then another successful field with the successfully uploaded file data. Is the empty successful array necessary? Is this by design or is this a bug?

@Murderlon
Copy link
Member

Hi, what do you mean exactly with "another succesful" field?

There is only one per file: https://uppy.io/docs/uppy/#uppy-upload.

@birthdaycorp
Copy link
Author

birthdaycorp commented Aug 26, 2021

I closed this because I wasn't able to reproduce it, but just got the same bug again.

I don't know how else to describe this? What I meant was: I'm uploading an image, right? But say it fails. In the hidden uppyResults input, Uppy then creates an empty successful array and one failed array with its own uploadID. When I try again, and the upload is successful, I get a second successful field (this one actually containing the successfully uploaded file's data), and one empty failed field. The uploadID for this attempt is different from the other one.

When I submit the form afterwords, the successful field containing the data I need is ignored. My app only sees the first empty one.

Is there a reason for saving the failures to the input?

<input 
 name="uppyResult" 
  type="hidden" 
  	value="[{
   		"successful":[],
    	"failed":[{
    		"source":"Dashboard",
    		"id":"uppy-a8geo/fw/400x400/jpg-1d-2v-1e-image/jpeg-10097-1626922525568",
    		"name":"a8GeO-FW_400x400.jpg",
    		"extension":"jpg",
    		"meta":{
    			"relativePath":null,
    			"name":"a8GeO-FW_400x400.jpg",
    			"type":"image/jpeg"
    		},
    		"type":"image/jpeg",
    		"data":{},
    		"progress":{
    			"uploadStarted":1629936957479,
   				"uploadComplete":false,
   				"percentage":0,
   				"bytesUploaded":0,
   				"bytesTotal":10097
   			},
    		"size":10097,
    		"isRemote":false,
   			"remote":"",
   			"preview":"blob:https://example.com/c9b493d4-aeda-4b6e-b733-fe1e7527a2ba",
   			"error":"Could not get /media_files/s3/params?filename=a8GeO-FW_400x400.jpg&amp;type=image%2Fjpeg&amp;. Error: This looks like a network error, the endpoint might be blocked by an internet provider or a firewall.\n\nSource error: [TypeError: Failed to fetch]"
    	}],
    	"uploadID":"ckss6dpgk00013h63y3dieyle"
  	}, 
  	{
  		"successful":[{
  			"source":"Dashboard",
  			"id":"uppy-a8geo/fw/400x400/jpg-1d-2v-1e-image/jpeg-10097-1626922525568",
  			"name":"a8GeO-FW_400x400.jpg",
  			"extension":"jpg",
  			"meta":{	
  				"relativePath":null,
  				"name":"a8GeO-FW_400x400.jpg",
  				"type":"image/jpeg",
  				"key":"cache/e539f2ef0d2729f52462dff4a1f225dd.jpg",
  				"Content-Disposition":"inline; filename=\"a8GeO-FW_400x400.jpg\"; filename*=UTF-8''a8GeO-FW_400x400.jpg",
  				"Content-Type":"image/jpeg",
  				"policy":"eyJleHBpcmF0aW9uIjoiMjAyMS0wOC0yNlQwMToxNjoxN1oiLCJjb25kaXRpb25zIjpbeyJidWNrZXQiOiJmcmFjdGlvbmNsdWItZGV2MiJ9LHsia2V5IjoiY2FjaGUvZTUzOWYyZWYwZDI3MjlmNTI0NjJkZmY0YTFmMjI1ZGQuanBnIn0seyJDb250ZW50LURpc3Bvc2l0aW9uIjoiaW5saW5lOyBmaWxlbmFtZT1cImE4R2VPLUZXXzQwMHg0MDAuanBnXCI7IGZpbGVuYW1lKj1VVEYtOCcnYThHZU8tRldfNDAweDQwMC5qcGcifSx7IkNvbnRlbnQtVHlwZSI6ImltYWdlL2pwZWcifSxbImNvbnRlbnQtbGVuZ3RoLXJhbmdlIiwwLDEwNDg1NzYwXSx7IngtYW16LWNyZWRlbnRpYWwiOiJBS0lBM0pFWlpGQU5PM0I2UjRUTy8yMDIxMDgyNi91cy13ZXN0LTEvczMvYXdzNF9yZXF1ZXN0In0seyJ4LWFtei1hbGdvcml0aG0iOiJBV1M0LUhNQUMtU0hBMjU2In0seyJ4LWFtei1kYXRlIjoiMjAyMTA4MjZUMDAxNjE3WiJ9XX0=",
  				"x-amz-credential":"AKIA3JEZZFANO3B6R4TO/20210826/us-west-1/s3/aws4_request",
  				"x-amz-algorithm":"AWS4-HMAC-SHA256",
  				"x-amz-date":"20210826T001617Z",
  				"x-amz-signature":"7bfb97293d887e4bbb287f69b9bf8dd4ebcfd80bb8113bbbc714ec462ef4f158"
  			},
  			"type":"image/jpeg",
  			"data":{},
  			"progress":{
  				"uploadStarted":1629936977540,
  				"uploadComplete":true,
  				"percentage":100,
  				"bytesUploaded":11980,
  				"bytesTotal":11980,
  				"postprocess":null
  			},
  			"size":10097,
  			"isRemote":false,
  			"remote":"",
  			"preview":"blob:https://example.com/b6029b40-ea7f-4453-9809-5741005feed6",
  			"xhrUpload":{
  				"method":"post",
  				"formData":true,
  				"endpoint":"https://example.com",
  				"metaFields":[
  					"key","Content-Disposition",
  					"Content-Type","policy",
  					"x-amz-credential",
  					"x-amz-algorithm",
  					"x-amz-date",
  					"x-amz-signature"
  				],"headers":{}
  			},
  			"response":{
  				"status":204,
  				"body":{
  					"location":null
  				},
  				"uploadURL":null
  			},
  			"uploadURL":null,
  			"isPaused":false
  		}],
    	"failed":[],
   		"uploadID":"ckss6e4xv00023h63uov94n5e"
 		}
  ]"
 >

@Murderlon Murderlon added Bug and removed Question labels Aug 26, 2021
@Murderlon
Copy link
Member

@arturi could you shed some light on this problem?

@stale
Copy link

stale bot commented Dec 3, 2022

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the Stale Old issues that haven't had activity recently label Dec 3, 2022
@stale stale bot closed this as completed Dec 17, 2022
@arturi arturi reopened this Dec 17, 2022
@stale stale bot removed the Stale Old issues that haven't had activity recently label Dec 17, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants