Skip to content

Commit

Permalink
Fix output name (#101)
Browse files Browse the repository at this point in the history
The output name was not being set on the file using
the convertJson endpoint.

#100
  • Loading branch information
wavded authored Oct 20, 2021
1 parent 84be6ef commit c108b82
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
3 changes: 2 additions & 1 deletion index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,7 @@ class Ogre {
}

let input = b.jsonUrl || data
let output = b.outputName || 'ogre'

let opts = {
format: (b.format || 'ESRI Shapefile').toLowerCase(),
Expand All @@ -153,7 +154,7 @@ class Ogre {
if ('forceUTF8' in b) opts.options.push('-lco', 'ENCODING=UTF-8')

let out = await ogr2ogr(input, opts)
res.attachment('ogre' + out.extname)
res.attachment(output + out.extname)

if (out.stream) {
out.stream.pipe(res)
Expand Down
2 changes: 1 addition & 1 deletion public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,7 @@ <h3>Accessing Ogre using a POST request</h3>
</li>
<li>
<code>outputName</code>
(optional) - the name for the resulting zip file
(optional) - the name for the resulting file
</li>
<li>
<code>forceUTF8</code>
Expand Down

0 comments on commit c108b82

Please sign in to comment.