Skip to content

Commit

Permalink
Merge pull request #333 from danceb/master
Browse files Browse the repository at this point in the history
Using theme id instead of name as filename for print and map export
  • Loading branch information
manisandro committed Sep 17, 2024
2 parents dafe0a3 + a68a9a1 commit 094c37a
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions plugins/MapExport.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ class MapExport extends React.Component {
<input min="1" onChange={ev => this.setState({scale: ev.target.value})} role="input" type="number" value={this.state.scale} />
);
}
const filename = this.props.theme.name.split("/").pop() + "." + this.state.selectedFormat.split(";")[0].split("/").pop();
const filename = this.props.theme.id.split("/").pop() + "." + this.state.selectedFormat.split(";")[0].split("/").pop();
const action = this.props.theme.url;
const exportExternalLayers = this.state.selectedFormat !== "application/dxf" && this.props.exportExternalLayers && ConfigUtils.getConfigProp("qgisServerVersion") >= 3;

Expand Down Expand Up @@ -412,7 +412,7 @@ class MapExport extends React.Component {
this.setState({exporting: false});
const contentType = response.headers["content-type"];
const ext = this.state.selectedFormat.split(";")[0].split("/").pop();
FileSaver.saveAs(new Blob([response.data], {type: contentType}), this.props.theme.name + '.' + ext);
FileSaver.saveAs(new Blob([response.data], {type: contentType}), this.props.theme.id + '.' + ext);
}).catch(e => {
this.setState({exporting: false});
if (e.response) {
Expand Down
4 changes: 2 additions & 2 deletions plugins/Print.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -508,7 +508,7 @@ class Print extends React.Component {
);
};
savePrintOutput = () => {
FileSaver.saveAs(this.state.pdfData, this.props.theme.name + '.pdf');
FileSaver.saveAs(this.state.pdfData, this.props.theme.id + '.pdf');
};
render() {
const minMaxTooltip = this.state.minimized ? LocaleUtils.tr("print.maximize") : LocaleUtils.tr("print.minimize");
Expand Down Expand Up @@ -625,7 +625,7 @@ class Print extends React.Component {
this.setState({ pdfData: file, pdfDataUrl: fileURL, outputLoaded: true });
} else {
const ext = this.state.selectedFormat.split(";")[0].split("/").pop();
FileSaver.saveAs(file, this.props.theme.name + '.' + ext);
FileSaver.saveAs(file, this.props.theme.id + '.' + ext);
}
}).catch(e => {
this.setState({printing: false, outputLoaded: true, printOutputVisible: false});
Expand Down

0 comments on commit 094c37a

Please sign in to comment.