Merge pull request #18 from lambdacasserole/fix-url-spaces

Handle spaces in URLs safely
This commit is contained in:
Saul Johnson
2017-08-22 19:47:40 +01:00
committed by GitHub
3 changed files with 4 additions and 4 deletions
+2 -2
View File
@@ -51,10 +51,10 @@ class MoleculeRenderer
{
// Proxy into Sourire for molecule render.
$img = Image::make($this->sourireUrl
. 'molecule/' . urlencode($smiles)
. 'molecule/' . rawurlencode($smiles)
. '?render-stereo-style=' . ($this->renderChiralLabels ? 'old' : 'none') // Label chiral atoms?
. '&render-comment-offset=16' // Give some space between label and molecule.
. ($this->customLabel === '' ? '' : ('&render-comment=' . urlencode($this->customLabel))));
. ($this->customLabel === '' ? '' : ('&render-comment=' . rawurlencode($this->customLabel))));
// Colorize molecule.
list($r, $g, $b) = sscanf($color, "%02x%02x%02x");
+1 -1
View File
@@ -48,7 +48,7 @@ class SmilesConverter
public function nameToSmiles($name)
{
// Sanitize name for URLs.
$encoded = urlencode($name);
$encoded = rawurlencode($name);
// Check if we've got the name cached already.
if ($this->isCacheEnabled()) {
+1 -1
View File
@@ -34,7 +34,7 @@ $(document).ready ->
# Gets the sanitized compound name as entered by the user.
#
getCompoundName = ->
encodeURIComponent compoundTextBox.val().replace(/\s/g, '')
encodeURIComponent compoundTextBox.val()
# Gets the sanitized compound SMILES structure as entered by the user.
#