Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

NoMethodError on rails xml builder + cache #2108

Closed
nanaya opened this Issue · 3 comments

3 participants

@nanaya

(and garbled characters without cache)

Demo application: https://github.com/edogawaconan/testutf8

(pardon the gemfile requirements)

Start rails and visit /test.atom to reproduce the error. Also additionally visit /test2.atom to see how the character becomes garbled without cache.

### assuming rbx with RBXOPT=-X19
### with nodejs' node somewhere in PATH
cd /some/where
git clone https://github.com/edogawaconan/testutf8
cd testutf8
rbx -S gem install bundler
rbx -S bundle install
rbx -S bundle exec rails s
### and then open/curl the aforementioned url - http://localhost:3000/test.atom etc

Notice that same variable rendered properly in html (/test.html).

No actual memcached server is required.

@Gibheer
Collaborator

The following code is what the cache executes

# encoding: utf-8                                                                                                                                                        
s = '<?xml version="1.0" encoding="UTF-8"?>                                                                                                                              
<feed xml:lang="en-US" xmlns="http://www.w3.org/2005/Atom">                                                                                                              
  <id>tag:zero-knowledge.org,2005:/test</id>                                                                                                                             
  <link rel="alternate" type="text/html" href="http://zero-knowledge.org:3000/"/>                                                                                        
  <link rel="self" type="application/atom+xml" href="http://zero-knowledge.org:3000/test.atom"/>                                                                         
  <author>椎名深夏</author>                                                                                                                                                
</feed>'                                                                                                                                                                 
f = s.slice!(0..-1)                                                                                                                                                      
puts f.inspect

The line causing the slice! is in actionpack. As it is building a Range there, I can't introduce nil as that would break.

@dbussink
Owner

The method missing error was fixed with 9653426, but the underlying string corruption still needs to be fixed.

The problem is that String#tr isn't encoding aware yet and replaces strings wrong.

@dbussink
Owner

Closing this one since the remaining problem of the invalid character is in issue #2157

@dbussink dbussink closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.