mirror of
https://github.com/EDCD/coriolis.git
synced 2025-12-08 22:33:24 +00:00
Additional info if import fails
This commit is contained in:
@@ -78,11 +78,11 @@ export default class Coriolis extends React.Component {
|
||||
|
||||
/**
|
||||
* Import a build directly
|
||||
* @param r {Object} the route object
|
||||
* @param {Object} r The current route
|
||||
*/
|
||||
_importBuild(r) {
|
||||
try {
|
||||
// Need to decode and gunzip the data
|
||||
// Need to decode and gunzip the data, then build the ship
|
||||
const data = zlib.gunzipSync(new Buffer(Utils.fromUrlSafe(r.params.data), 'base64'));
|
||||
const json = JSON.parse(data);
|
||||
const ship = CompanionApiUtils.shipFromJson(json);
|
||||
@@ -90,7 +90,7 @@ export default class Coriolis extends React.Component {
|
||||
r.params.code = ship.toString();
|
||||
this._setPage(OutfittingPage, r);
|
||||
} catch (err) {
|
||||
this.setState({ error: err });
|
||||
this._onError("Failed to import ship", r.path, 0, 0, err);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -65,7 +65,7 @@ export function shallowEqual(objA, objB) {
|
||||
* @return {string} the converted string
|
||||
*/
|
||||
export function toUrlSafe(data) {
|
||||
return data.replace(/\\/g, '-').replace(/\+/g, '_');
|
||||
return data.replace(/\//g, '-').replace(/\+/g, '_');
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user