serialize :properties, Hash
before_validation :check_encoding
+ before_validation :log_invalid_manifest_format
before_validation :check_signatures
before_validation :strip_signatures_and_update_replication_confirmed
validate :ensure_pdh_matches_manifest_text
now: db_current_time.to_i,
}
self.manifest_text.each_line do |entry|
- entry.split[1..-1].each do |tok|
- if tok =~ FILE_TOKEN
+ entry.split.each do |tok|
+ if tok == '.' or tok.starts_with? './'
+ # Stream name token.
+ elsif tok =~ FILE_TOKEN
# This is a filename token, not a blob locator. Note that we
# keep checking tokens after this, even though manifest
# format dictates that all subsequent tokens will also be
end
end
+ def log_invalid_manifest_format
+ begin
+ Keep::Manifest.validate! manifest_text if manifest_text
+ rescue => e
+ logger.warn e
+ end
+ true
+ end
+
def signed_manifest_text
if has_attribute? :manifest_text
token = current_api_client_authorization.andand.api_token
line.rstrip!
new_words = []
line.split(' ').each do |word|
- if match = Keep::Locator::LOCATOR_REGEXP.match(word)
+ if new_words.empty?
+ new_words << word
+ elsif match = Keep::Locator::LOCATOR_REGEXP.match(word)
new_words << yield(match)
else
new_words << word