Coder Social home page Coder Social logo

qrcode-rails's People

Watchers

 avatar

qrcode-rails's Issues

I have created a qrcode gem that may help your project

I have created a qrcode gem that may well be useful to your project as it moves 
the qrcode 
generation back to the server and not on the client.

http://rubyforge.org/projects/rqrcode/

sudo yum install rqrcode

Best.
Duncan

Original issue reported on code.google.com by [email protected] on 26 Feb 2008 at 8:35

jQuery instead of Prototype

Upon loading the JavaScript in a jQuery environment qrcode.rb calls Prototype. 

replacing the Element.update line with this line will fix it. 

$(text).appendTo('##{id}');

Original issue reported on code.google.com by [email protected] on 4 Mar 2011 at 3:04

Does not work in XHTML

What steps will reproduce the problem?
1. Use XHTML (mime-type application/xhtml or xml).

Solution: put "/* <![CDATA */" and "/* ]]> */" around Javascript code to
make it compatible with both HTML and XHTML (and XML-like HTML5).

Original issue reported on code.google.com by [email protected] on 16 Aug 2009 at 9:27

Problems with URL-s, possibly XSS

This issue is slightly connected to #2.

There's a line in lib/qrcode.rb:

qr.addData('#{url}');

There is a problem with user-specified data. URL must not be included here
lierally (as in example above), there must be escaping applied before
according to displayed document type. In HTML and XHTML the best is to use
.to_json that will change URL to appropiate Javascript object - string.

It will then be:

qr.addData(#{url.to_json});

It will ensure that user will not escape from string with characters like '
in URL.

In XHTML, if script is included inside CDATA section, there must be
additional escaping of ]]> to prevent user from escaping to HTML by
including "]]>" in his URL.

gsub(']]>', ']]>]]&gt;<![CDATA[')

This arises second problem: qrcode does not know if it should escape "]]>",
because it does not know if document is XHTML. There might be additional
parameter for this (don't check content-type, because it might be set by
user in after_filters). So in the end it might be:

def qrcode(url, size=2, level=4, id=nil, xhtml=false)
…
qr.addData (#{xhtml ? url.to_json.gsub(']]>', ']]>]]&gt;<![CDATA[') :
url.to_json});

(Notice that .to_json must be first before escaping ]]> sequences in XHTML).

Regards. :p

Original issue reported on code.google.com by [email protected] on 16 Aug 2009 at 10:03

Rails 3 Defect on init.rb

Rails 3 deprection of:
#ActionView::Helpers::AssetTagHelper::register_javascript_include_default('qrcod
e')

Should be changed to:
ActionView::Helpers::AssetTagHelper.register_javascript_expansion :qrcode => 
["qrcode"]


Original issue reported on code.google.com by [email protected] on 17 Mar 2011 at 6:18

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.