Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mechanize should not change the content of a malformed csv #378

Closed
ngiger opened this issue May 2, 2014 · 1 comment
Closed

mechanize should not change the content of a malformed csv #378

ngiger opened this issue May 2, 2014 · 1 comment

Comments

@ngiger
Copy link

ngiger commented May 2, 2014

The page https://download.epha.ch/cleaned/matrix.csv contained (for a short period)
a line with an extraneous line-feed in it. It looked like this (shortened to give only a good and a bad example)

"ATC1","Name1","ATC2","Name2","Info","Mechanismus","Effekt","Massnahmen","Grad"
"N06AB06","Sertralin","M03BX02","Tizanidin","Keine Interaktion","Tizanidin wird über CYP1A2 metabolisiert. Sertralin beeinflusst CYP1A2 jedoch nicht.","Keine Interaktion.","Die Kombination aus Sertralin und Tizanidin hat kein bekanntes Interaktionspotential.","A"
"C01BD01","Amiodaron","C10AA05","Atorvastatin","Erhöhtes Risiko für Myopathien","Amiodaron hemmt CYP3A4 und damit auch den Metabolismus von Atorvastatin.","Bei der Kombination von sowohl Simvastatin als auch Atorvastatin mit Amiodaron konnte ein erhöhtes Risiko für Myopathien und Rhybdomyolyse nachgewiesen werden . ","Diese Kombination sollte vermieden werden. Auch der Hersteller von Amiodaron (Schweizer Fachinfromation zu Cordarone®) empfiehlt bei der Anwendung ein Statin anzuwenden, das nicht über CYP3A4 metabolisiert wird. Falls die Kombination allerdings erforderlich ist, sollten möglichst niedrige Stardosierungen von Atorvastatin und auch niedrigere Erhaltungsdosierungen gewählt werden. Bessere Alternativen wären Pravastatin oder Rosuvastatin, da diese nicht signifikant über das CYP-System metabolisiert werden . Klinisch auf Myopathie-Zeichen achten, ggf. ergänzt durch CK-Kontrolle.","
D"

The following ruby snippet was able to reproduce this error with mechanize 2.7.0

require 'mechanize'
puts "Checking for a mechanize error in version #{Mechanize::VERSION} "
@url = 'https://download.epha.ch/cleaned/matrix.csv'
@agent = Mechanize.new
response = @agent.get(@url)
if /""/.match(response.content)
  puts "Triggered a mechanize error."
  puts  /""/.match(response.content)
end

The response.content however contained in the second and subsequent lines always one occurence of ""

@leejarvis
Copy link
Member

This works fine in the latest version of Mechanize (2.7.4.beta2). Closing this ticket, please re-open if you can reproduce with the latest version of Mechanize. Thanks for reporting

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants