Resource dropwell (bug)

Maybe a bug, or maybe I’m holding it wrong.

Image illustrates, but for completeness…

Component properties

{
	"groups": [{
		"title": "Settings",
		"icon": "folder",
		"properties": [{
			"title": "mp3 Audio File",
			"id": "audiofile",
			"resource": {
				"accepts": "mp3"
			}
		}]
	}]
}

Component hooks

const transformHook = (rw) => {    

	const { audiofile = {} } = rw.props
	
	rw.setProps({
		audiofile,
		node: rw.node
	})
}

exports.transformHook = transformHook;

Firstly, the dropwell isn’t being restricted to mp3 files, I can drop anything in there.

Secondly, the resulting path is appended with @1024.png, so somehow the mp3 file is being processed as a png image file.

Link to screenshot
http://www.garysimpson.co.uk/vault/temp-sharing/uicontrol-shot.png

This is a known “bug” - we haven’t actually gotten around to implementing restrictions to the resource drop well… yet!

It’s on the list and will be implemented before final release :slight_smile:

It looks like there may be a bug here—we’ll need to do some internal testing to understand why and how @1024 is being appended in your case.

For context, the appended @{number} comes from the resource resizing API (rw.resizeResource()). If you’re not using that, it shouldn’t be adding the extra value.

I also wanted to clarify a couple of things about the resource control. When accessed directly in a template, the resource control returns an image for the resource. For example, if you have a resource control with the ID audioResource, using {{audioResource}} in a template will return an image representation of the resource. I think this makes sense for videos, where a thumbnail can be useful, but might not be what you want for audio files.

If you’re looking to get the actual file path instead, you should access the path property from the resource. Using {{audioResource.path}} in your template will give you the full path to the file.

Let me know if that helps :slight_smile:

1 Like