mirror of
https://github.com/neocities/neocities.git
synced 2025-04-24 17:22:35 +02:00
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.
7 lines
114 B
Ruby
7 lines
114 B
Ruby
class Tempfile
|
|
alias_method :size_original, :size
|
|
def size
|
|
s = size_original
|
|
s.nil? ? 0 : s
|
|
end
|
|
end
|