Skip to content

Commit

Permalink
Мсправления по замечаниям MR
Browse files Browse the repository at this point in the history
  • Loading branch information
rpiontik committed Aug 26, 2022
1 parent 167ef0e commit cec3807
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
10 changes: 6 additions & 4 deletions src/helpers/plantuml.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,12 @@ export default {
// eslint-disable-next-line no-undef
let compressor = new Zopfli.RawDeflate(arr);
let compressed = compressor.compress();
let serverURL = config.pumlServer;
if (!requests.isURL(serverURL)) {
serverURL = `${window?.location?.protocol || 'https:'}//${config.pumlServer}`;
}

const serverURL =
!requests.isURL(config.pumlServer)
? `${window?.location?.protocol || 'https:'}//${config.pumlServer}`
: config.pumlServer;

return serverURL + this.encode64_(compressed);
}
};
2 changes: 1 addition & 1 deletion src/helpers/requests.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ export default {
axios,
isURL(url) {
// eslint-disable-next-line no-useless-escape
return url.match(/https?:\/\/(www\.)?[-a-zA-Z0-9@:%._\+~#=]{1,256}\.?[a-zA-Z0-9()]{1,6}\b([-a-zA-Z0-9()@:%_\+.~#?&//=]*)/);
return url && url.match(/https?:\/\/(www\.)?[-a-zA-Z0-9@:%._\+~#=]{1,256}\.?[a-zA-Z0-9()]{1,6}\b([-a-zA-Z0-9()@:%_\+.~#?&//=]*)/);
},
isExtarnalURI(uri) {
return (uri.slice(0, window.origin.length) !== window.origin) && this.isURL(uri);
Expand Down

0 comments on commit cec3807

Please sign in to comment.