Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Comparing changes

Choose two branches to see what's changed or to start a new pull request. If you need to, you can also compare across forks.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also compare across forks.
base fork: youpy/rack-musicindex
base: 19bb73c36b
...
head fork: youpy/rack-musicindex
compare: 5fcd2fb10a
Checking mergeability… Don't worry, you can still create the pull request.
  • 3 commits
  • 2 files changed
  • 0 commit comments
  • 1 contributor
Showing with 15 additions and 4 deletions.
  1. +14 −3 lib/rack/musicindex.rb
  2. +1 −1  lib/rack/musicindex/version.rb
View
17 lib/rack/musicindex.rb
@@ -17,11 +17,14 @@ def init(options)
def call(env)
path_info = env['PATH_INFO']
+ # to compare with static_path which is utf-8 encoding
+ path_info.force_encoding('UTF-8') if path_info.respond_to? :force_encoding
+
update_files
if dirs[path_info]
serve_podcast(env)
- elsif static_paths.include?(URI.unescape(path_info))
+ elsif static_paths.include?(unescape(path_info))
serve_mp3(env)
else
status, headers, response = @app.call(env)
@@ -46,7 +49,7 @@ def serve_mp3(env)
status, headers, response = @app.call(env)
method = env['REQUEST_METHOD']
- path_info = URI.unescape(env['PATH_INFO'])
+ path_info = unescape(env['PATH_INFO'])
body = open(static_paths[path_info], 'rb').read
headers["Content-Type"] = 'audio/mpeg'
@@ -120,7 +123,7 @@ def podcast(env)
tag = id3(file)
author = tag[:artist]
name = ::File.basename(file)
- item_link = URI.escape(url + '/' + name)
+ item_link = escape(url + '/' + name)
xml.item do
xml.title tag[:name] || name
@@ -138,5 +141,13 @@ def podcast(env)
end
end
end
+
+ def escape(str)
+ URI.escape(str)
+ end
+
+ def unescape(str)
+ URI.unescape(str)
+ end
end
end
View
2  lib/rack/musicindex/version.rb
@@ -1,5 +1,5 @@
module Rack
module Musicindex
- VERSION = "0.2.0"
+ VERSION = "0.2.1"
end
end

No commit comments for this range

Something went wrong with that request. Please try again.