filepond icon indicating copy to clipboard operation
filepond copied to clipboard

Support restore HEAD metadata

Open PinkDuck opened this issue 4 years ago • 3 comments

Is your feature request related to a problem? Please describe. I'd like to be able to set method:"HEAD" on restore options to be able to restore limbo/server-temp files without downloading hundreds of megabytes of previously uploaded binary content before final form submission. Though if I try this the source ID is shown instead of filename, despite response content-disposition header. If the standard "GET" method is used with a response body then the filename is displayed.

e.g. HEAD http://localhost:8080/API?restore=2

HTTP/1.1 200 OK Content-Length: 123456 Content-Type: application/zip Expires: -1 Content-Disposition: inline; filename="my-file.zip" X-Content-Transfer-Id: 2 Date: Mon, 28 Jun 2021 11:46:50 GMT

This is rendered as a row with identifier "2" and 123 kB size in an green-background already uploaded style.

Describe the solution you'd like I would like HEAD method to be supported on the server resolve action, such that limbo file IDs from a previous page visit can be restored efficiently by not needing to download full content from server when local preview/render is not required. The row should display with the filename text instead of the server ID from the Content-Disposition HEAD response header.

Describe alternatives you've considered Providing a mock file interface within the create() set-up function’s files array works, but means I have to mediate the server-held properties beyond ID to the client to populate the mock objects if I want to avoid the bulk of file downloads.

Additional context <input id="filepond" type="file" accept=".zip,application/zip,application/x-zip-compressed" multiple />

Constructor object used:

{
	required: true,
	server: {
		process: "/API",
		fetch: null,
		restore: {
			url: "/API?restore=",
			method: "HEAD"
		}
	},
	files: [
		{
			// the server file reference
			source: "2",

			// set type to limbo to tell FilePond this is a temp file
			options: {
				type: "limbo",
				file: {
					name: "my-file.zip",
					size: 3001025,
					type: "application/zip"
				}
			}
		}
	]
}

PinkDuck avatar Jul 02 '21 09:07 PinkDuck

The file prop should be inside the file options prop.

files: [
  {
    source: "2",
    options: {
      type: "limbo",
      file: {
        name: "my-file.zip",
        size: 3001025,
        type: "application/zip"
      }
    }
  }
]

rikschennink avatar Jul 08 '21 10:07 rikschennink

Thanks, I guess I must have confused that with the instance files property.

I would still appreciate if you could see if relatively easy to support HEAD method restore. It's mostly there now, aside from the filename display issue.

PinkDuck avatar Jul 08 '21 11:07 PinkDuck

I'll definitely consider that for a future release.

rikschennink avatar Jul 09 '21 06:07 rikschennink