lib/zold/node/front.rb in zold-0.11.10 vs lib/zold/node/front.rb in zold-0.11.11
- old
+ new
@@ -145,15 +145,17 @@
put %r{/wallet/(?<id>[A-Fa-f0-9]{16})/?} do
id = Id.new(params[:id])
wallet = settings.wallets.find(id)
request.body.rewind
- body = request.body.read
- if wallet.exists? && AtomicFile.new(wallet.path).read == body
+ after = request.body.read
+ before = wallet.exists? ? AtomicFile.new(wallet.path).read : ''
+ if before == after
status 304
return
end
- settings.entrance.push(id, body, sync: !params[:sync].nil?)
+ settings.log.info("Wallet #{id} is new: #{before.length}b != #{after.length}b")
+ settings.entrance.push(id, after, sync: !params[:sync].nil?)
JSON.pretty_generate(
version: VERSION,
score: score.to_h
)
end