• R/O
  • HTTP
  • SSH
  • HTTPS

Commit

Tags
Keine Tags

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

Commit MetaInfo

Revision19993864e78e6e41dfdfc6c81fccfda3d972d6b1 (tree)
Zeit2020-08-31 05:04:59
AutorHMML <hmml3939@gmai...>
CommiterHMML

Log Message

Fix feed id as digest.

Ändern Zusammenfassung

Diff

--- a/app/models/jma_feed.rb
+++ b/app/models/jma_feed.rb
@@ -17,7 +17,7 @@ class JmaFeed < ApplicationRecord
1717 Rails.logger.info "Fetching success."
1818 doc = Nokogiri::XML(b)
1919 doc.remove_namespaces!
20- fid = doc.xpath("/feed/id").text
20+ fid = Digest::SHA2.hexdigest b
2121 obj = find_by(feed_id: fid)
2222 if obj
2323 Rails.logger.info "Jma feed id=#{fid} found. Skip creation and return existing entry."
@@ -29,7 +29,7 @@ class JmaFeed < ApplicationRecord
2929 def body=(xml)
3030 self[:body] = xml
3131 self.feed_time = Time.parse(xml_doc.xpath("/feed/updated").text)
32- self.feed_id = xml_doc.xpath("/feed/id").text
32+ self.feed_id = Digest::SHA2.hexdigest(xml)
3333 self.last_process_id = nil
3434 end
3535