Logo
Explore Help
Sign In
1berry/neocities
1
0
Fork 0
You've already forked neocities
Code Issues Packages Projects Releases Wiki Activity
neocities/ext/tempfile.rb

8 lines
114 B
Ruby
Raw Permalink Normal View History

Fix tempfile returning nil for empty files This is an "monkey patch" to have Tempfile return 0 instead of nil when a tempfile is empty. This has caused an unexplained exception in our logs for years, and I was really surprised when I caught it, and more surprised that nobody has ever reported it to us before. I really think this is a bug, and have filed it as a bug on the ruby tracker. I haven't seen any consequences (yet) to doing this, so I'm just going to run with it and see what happens. If it blows something up (how? what scenario?), I'll try a different approach.
2017-02-06 11:26:14 -08:00
class Tempfile
alias_method :size_original, :size
def size
s = size_original
s.nil? ? 0 : s
end
end
Reference in New Issue Copy Permalink
Powered by Gitea Version: 1.23.8 Page: 241ms Template: 8ms
English
Bahasa Indonesia Deutsch English Español Français Gaeilge Italiano Latviešu Magyar nyelv Nederlands Polski Português de Portugal Português do Brasil Suomi Svenska Türkçe Čeština Ελληνικά Български Русский Українська فارسی മലയാളം 日本語 简体中文 繁體中文(台灣) 繁體中文(香港) 한국어
Licenses API