openlab-at-city-tech / webworkqa

WeBWorK integration for WordPress and BuddyPress
GNU General Public License v2.0
4 stars 2 forks source link

images are wrapped in anchor tag that has relative href where it should be absolute #56

Closed moui72 closed 8 years ago

moui72 commented 8 years ago

Images on pages like problem: graphing cosine are wrapped in an <a> tag. The href for it is relative to http://openlabdev.org/webwork-playground/, but the image is actually located on a different domain -- http://mathww.citytech.cuny.edu/ so when clicked they resolve to an openlab 404.

There's also an extraneous slash (WW-Dev//gif/), not that it matters :P

also see #55 as clicking an image collapses embedded problems (but since we're leaving the page, do we care?)

404 url: http://openlabdev.org/webwork2_files/tmp/WW-Dev//gif/a14fa094-f5ae-3f7a-9247-5c4976fd6da9___75520ded-d8cc-3f86-a942-5c8a0029700d.png

ol url: http://openlabdev.org/webwork-playground/?post_data_key=webwork_post_data_33882f74fb7d0e68192011c8f7c180be#/problem/local/GraphingSineCosine/function-graphing.pg

ww url: http://mathww.citytech.cuny.edu/webwork2/WW-Dev/GraphingSineCosine/4/?key=JSV1VOTWuq1Nbol4l04baE28KCksbTVD&effectiveUser=student1&user=student1

offending html

<a href="/webwork2_files/tmp/WW-Dev//gif/a14fa094-f5ae-3f7a-9247-5c4976fd6da9___75520ded-d8cc-3f86-a942-5c8a0029700d.png">
  <img src="http://mathww.citytech.cuny.edu/webwork2_files/tmp/WW-Dev//gif/a14fa094-f5ae-3f7a-9247-5c4976fd6da9___75520ded-d8cc-3f86-a942-5c8a0029700d.png">
</a>
boonebgorges commented 8 years ago

The problem in this specific case is that the markup has stray whitespace - <a href =" (note the space after href). I've rewritten the parser to use a regular expression that should account for this. Note that it'll only apply to newly-imported problem text, so be sure to try with a new question (the "View My Problem" text belonging to the new question should work).

moui72 commented 8 years ago

looks good