From: SHIBATA H. <nul...@cl...> - 2013-07-21 07:49:48
|
SHIBATA Hiroshi 2013-07-21 16:49:25 +0900 (Sun, 21 Jul 2013) New Revision: 42cdc564e399154f9636bf1421f554b62d6859c3 https://github.com/tdiary/tdiary-core/commit/42cdc564e399154f9636bf1421f554b62d6859c3 Message: document_root should be handled condition of request. Modified files: misc/plugin/makerss.rb Modified: misc/plugin/makerss.rb (+10 -2) =================================================================== --- misc/plugin/makerss.rb 2013-07-21 10:19:13 +0900 (f03b752) +++ misc/plugin/makerss.rb 2013-07-21 16:49:25 +0900 (29520a3) @@ -105,7 +105,7 @@ class MakeRssFull def file f = @conf['makerss.file'] || 'index.rdf' f = 'index.rdf' if f.empty? - f =~ %r|^/| ? f : "#{TDiary.document_root}/#{f}" + f =~ %r|^/| ? f : "#{document_root}/#{f}" end def writable? @@ -137,6 +137,14 @@ class MakeRssFull u = "#{base_url}#{File.basename(file)}" if u.empty? u end + + def document_root + if @cgi.is_a?(RackCGI) + File.join(TDiary.server_root, 'public') + else + TDiary.server_root + end + end end @makerss_rsses << MakeRssFull::new(@conf, @cgi) @@ -154,7 +162,7 @@ class MakeRssNoComments < MakeRssFull def file f = @conf['makerss.no_comments.file'] || 'no_comments.rdf' f = 'no_comments.rdf' if f.empty? - f =~ %r|^/| ? f : "#{TDiary.document_root}/#{f}" + f =~ %r|^/| ? f : "#{document_root}/#{f}" end def write( encoder ) |