Pass current file name through to export command (#4503)
* Pass current file name through to export command * A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu-latest-8-cores) * Oops I needed a couple other things, not just that one line change * A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu-latest-8-cores) * Undo overriding of internal zipped file names That was liable to cause conflicts and whatnot per @jessfraz feedback * Update E2E test that was still looking for `output.gltf` * Missed one other test my bad * Should've just grepped for output.gltf to begin with --------- Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> Co-authored-by: Paul Tagliamonte <paul@zoo.dev>
This commit is contained in:
@ -68,7 +68,16 @@ const save_ = async (file: ModelingAppFile, toastId: string) => {
|
||||
}
|
||||
|
||||
// Saves files locally from an export call.
|
||||
export async function exportSave(data: ArrayBuffer, toastId: string) {
|
||||
// We override the file's name with one passed in from the client side.
|
||||
export async function exportSave({
|
||||
data,
|
||||
fileName,
|
||||
toastId,
|
||||
}: {
|
||||
data: ArrayBuffer
|
||||
fileName: string
|
||||
toastId: string
|
||||
}) {
|
||||
// This converts the ArrayBuffer to a Rust equivalent Vec<u8>.
|
||||
let uintArray = new Uint8Array(data)
|
||||
|
||||
@ -80,9 +89,10 @@ export async function exportSave(data: ArrayBuffer, toastId: string) {
|
||||
zip.file(file.name, new Uint8Array(file.contents), { binary: true })
|
||||
}
|
||||
return zip.generateAsync({ type: 'array' }).then((contents) => {
|
||||
return save_({ name: 'output.zip', contents }, toastId)
|
||||
return save_({ name: `${fileName || 'output'}.zip`, contents }, toastId)
|
||||
})
|
||||
} else {
|
||||
files[0].name = fileName || files[0].name
|
||||
return save_(files[0], toastId)
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user