parentheses in image filenames won't parse in Markdown properly
The problem
When uploading images to new posts (comments and wiki pages to) at https://publiclab.org/post (login required), if the images have parentheses in their filenames, Markdown can't parse them for proper display. They appear as follows -- the actual path is find/replaced by the server, but the "alt" filename which appears first retains the parentheses:
[](//i.publiclab.org/system/images/photos/000/015/114/original/test_%281%29.png)
Proposed fix
We should replace them at upload time with hyphens -- the alt attribute is not necessary for routing, it's just for screen readers. The insertion happens here: https://github.com/publiclab/plots2/blob/master/app/assets/javascripts/dragdrop.js#L65-L67
We should be able to swap the data.result['filename'] with one where we .replace() either using parentheses strings or Regex.
For how $E.wrap() works, see https://github.com/publiclab/plots2/blob/master/app/assets/javascripts/editor.js
Steps to fix
- [ ] claim this issue with a comment
- [ ] set up a repository locally and make sure that all tests pass
- [ ] start a pull request (see contributing to Public Lab software) but mark it as "in progress"
- [ ] fix the issue following the steps above
- [ ] make sure all tests pass
- [ ] alert someone via either the developers list (see below) to have your pull request merged. This may take a few extra steps depending on when you do it, but we'll help you out!
Please email the developers list (see https://publiclab.org/developers) if you have questions!
Use character class :
mystring.replace(/[()]/g , "-")
Hi @jiteshjha! Thank you again for your valuable contribution to Public Lab -- in your original First-Timers-Only issue as well as in GSOC!!! I would like to invite you to join us in a video conference to say a few words about what you contributed as a First TImer and how your experience was. The event is https://publiclab.org/openhour, and it’s coming right up on November 7th, at 1pm EDT which is UTC/GMT -4.
Please feel free to respond here, or else email [email protected], [email protected], [email protected].