我收到一个错误:Uncaught TypeError: Cannot read property '1' of null
。这是什么意思?错误的来源是以下行id: file.meta['key'].match(/^cache\/(.+)/)[1]
:
uppy.on('upload-success', (file, response) => {
// construct uploaded file data in the format that Shrine expects
const uploadedFileData = {
id: file.meta['key'].match(/^cache\/(.+)/)[1], // object key without prefix
storage: 'cache',
metadata: {
size: file.size,
filename: file.name,
mime_type: file.type,
}
}
// set hidden field value to the uploaded file data so that it's submitted
// with the form as the attachment
hiddenInput.value = JSON.stringify(uploadedFileData)
})
我认为这是试图在不存在的索引处选择一些东西,但是……什么索引确实存在?