I have an issue with the file transfer API.
When I try to send a file from my smartwatch (Sense) to the companion app, it throws "ReferenceError: filename not defined", but the files do get successfully sent to the companion. Also, when I list all files in the /private/data directory, all the files that need to be sent are there. See my code below.
```
function sendFile(fileName) {
if (!fileName) {
console.log(`filename not specified, aborting`)
}
let dirIter
const listDir = listDirSync("/private/data");
while((dirIter = listDir.next()) && !dirIter.done) {
console.log(`file in directory ${dirIter.value}`);
}
//TODO: throws error saying that filename does not exist.
//The file did, however, get to the companion app.
outbox
.enqueueFile(`/private/data/${fileName}`)
.then(ft => {
if (filename.replace(/[0-9]/g, '')=="acc"){
statusEl.text = `Sending file ${fileName} of ${state.fileNumberRecordingAcc} ...`
display.poke()
console.log(`Sending file ${fileName} of ${state.fileNumberRecordingAcc}: queued`);
} else {
statusEl.text = `Sending file ${fileName} of ${state.fileNumberRecordingHR} ...`
display.poke()
console.log(`Sending file ${fileName} of ${state.fileNumberRecordingHR}: queued`);
}
})
.catch(err => {
console.error(`Failed to queue transfer of ${fileName}: ${err}`);
errorEl.text = "Can't send " + fileName + " to companion"
display.poke()
})
}
```
Does anyone have an idea what could cause this weird behaviour?