mirror of
https://github.com/discourse/discourse.git
synced 2025-02-16 23:42:44 +08:00
FIX: remove nil
items before sorting the sha1 string array. (#18571)
Previously, when the array had both nil and string values it returned the error "comparison of NilClass with String failed". Now I added the `.compact` method to prevent this issue as per @martin-brennan's suggestion https://github.com/discourse/discourse/pull/18431#discussion_r984204788
This commit is contained in:
parent
0fe111e492
commit
7f167de10b
|
@ -225,7 +225,7 @@ class Stylesheet::Manager::Builder
|
|||
sha1s << upload_field.upload&.sha1
|
||||
end
|
||||
|
||||
Digest::SHA1.hexdigest(sha1s.sort!.join("\n"))
|
||||
Digest::SHA1.hexdigest(sha1s.compact.sort!.join("\n"))
|
||||
end
|
||||
|
||||
def default_digest
|
||||
|
|
|
@ -374,6 +374,16 @@ RSpec.describe Stylesheet::Manager do
|
|||
type_id: ThemeField.types[:theme_upload_var]
|
||||
)
|
||||
|
||||
upload2 = UploadCreator.new(image2, "icon.png").create_for(-1)
|
||||
field = ThemeField.create!(
|
||||
theme_id: theme.id,
|
||||
target_id: Theme.targets[:common],
|
||||
name: "icon",
|
||||
value: "",
|
||||
upload_id: upload2.id,
|
||||
type_id: ThemeField.types[:theme_upload_var]
|
||||
)
|
||||
|
||||
manager = manager(theme.id)
|
||||
|
||||
builder = Stylesheet::Manager::Builder.new(
|
||||
|
|
Loading…
Reference in New Issue
Block a user