Problem mit fehlendem Abzeichenbild

Hallo,

Ich habe ein Problem mit dem Abzeichenbereich. Ich habe einige Abzeichen geändert und einige Bilder hinzugefügt. Nach 6 Monaten habe ich ein Backup wiederhergestellt und alles funktioniert einwandfrei, außer dem Abzeichenbereich. Ich versuche, mich im abgesicherten Modus anzumelden und alle Plugins zu deaktivieren… aber das Problem bleibt dasselbe. Wie kann ich die Abzeichenbereiche mit Standardnamen und -bildern wiederherstellen?

Fehler wird angezeigt

Nachricht (2 Kopien gemeldet)

NoMethodError (undefinierte Methode `url' für nil:NilClass).
app/models/badge.rb:306:in `image_url'
(eval):10:in `_fast_attributes'
app/controllers/application_controller.rb:484:in `serialize_data'
app/controllers/badges_controller.rb:30:in `index'
app/controllers/application_controller.rb:387:in `block in with_resolved_locale'
app/controllers/application_controller.rb:387:in `with_resolved_locale'
lib/middleware/omniauth_bypass_middleware.rb:71:in `call'
lib/content_security_policy/middleware.rb:12:in `call'
lib/middleware/anonymous_cache.rb:356:in `call'
config/initializers/100-quiet_logger.rb:23:in `call'
config/initializers/100-silence_logger.rb:31:in `call'
lib/middleware/enforce_hostname.rb:23:in `call'
lib/middleware/request_tracker.rb:198:in `call'

Backtrace

app/models/badge.rb:306:in `image_url'
active_model_serializers (0.8.4) lib/active_model/serializer.rb:99:in `block in attribute'
(eval):10:in `_fast_attributes'
active_model_serializers (0.8.4) lib/active_model/serializer.rb:468:in `rescue in attributes'
active_model_serializers (0.8.4) lib/active_model/serializer.rb:455:in `attributes'
active_model_serializers (0.8.4) lib/active_model/serializer.rb:480:in `_serializable_hash'
active_model_serializers (0.8.4) lib/active_model/serializer.rb:359:in `serializable_hash'
active_model_serializers (0.8.4) lib/active_model/array_serializer.rb:89:in `block in _serializable_array'
active_model_serializers (0.8.4) lib/active_model/array_serializer.rb:79:in `map'
active_model_serializers (0.8.4) lib/active_model/array_serializer.rb:79:in `_serializable_array'

Umgebung

HTTP HOSTS: site.com
1 „Gefällt mir“

Wurden andere Bilder korrekt wiederhergestellt?

Haben Sie sichergestellt, dass Uploads im Backup enthalten sind?

Verwenden Sie S3 zum Speichern Ihrer Uploads? Wenn nicht, könnten Sie in den Container wechseln und zu /shared/uploads/default/original/1X gehen. Befinden sich dort Dateien?

1 „Gefällt mir“

Ja, ich benutze kein S3 und habe immer Anhangsbilder in das Backup aufgenommen.
Was ich jetzt suche, ist, wie man die Abzeichenbilder zurücksetzt.

Out of the box, there is no way to “make reset for badge images” that I know of.

What I’d do first is check that the badges missing images were at least restored. If you check the badges table you can get the ID of the image at the image_upload field. Then use that ID in the uploads table, to get the URL of the image, like so:

select url from uploads where id = <badge-upload-id>

The URL looks something like this: /uploads/default/original/1X/c1325294cd04ae6e9072a2577543dad66cf31afe.jpeg and from there, you can extract the name of the file, in this case it would be c1325294cd04ae6e9072a2577543dad66cf31afe.jpeg

Then you can check in the server that the image is there with find or whatever method you prefer

cd /
find . -name c1325294cd04ae6e9072a2577543dad66cf31afe.jpeg

Once you made sure the images were restored, at the right path, then you can continue debugging as the issue is somewhere else.

The version of Discourse from the backup is too different from the version of Discourse you are restoring into?

Maybe someone else in the community knows more about this, though.

1 „Gefällt mir“

Perfekt, aber woher weiß ich die fehlende Badge-URL oder den Namen?

Ich kann nicht herausfinden, woher ich die fehlende URL oder den Namen des Badge-Bildes kenne.

Folgen Sie der Anleitung hier Discourse Data Explorer zur Installation des Data Explorer Plugins, Sie können es verwenden, um die Badges-Tabelle zu inspizieren. Konzentrieren Sie sich auf Ihre benutzerdefinierten Badges.

1 „Gefällt mir“

Ich habe es installiert, aber ich konnte die Badge-Tabelle nicht finden.

Dies ist der Fehler, den ich erhalte, wenn ich das Profil des Administrators öffne:

Message

NoMethodError (undefined method `url' for nil:NilClass)
app/models/badge.rb:306:in `image_url'
(eval):10:in `_fast_attributes'
lib/freedom_patches/ams_include_without_root.rb:54:in `include!'
lib/freedom_patches/ams_include_without_root.rb:54:in `include!'
app/controllers/users_controller.rb:92:in `block (2 levels) in show'
app/controllers/users_controller.rb:89:in `show'
app/controllers/application_controller.rb:387:in `block in with_resolved_locale'
app/controllers/application_controller.rb:387:in `with_resolved_locale'
lib/middleware/omniauth_bypass_middleware.rb:71:in `call'
lib/middleware/content_security_policy/middleware.rb:12:in `call'
lib/middleware/anonymous_cache.rb:356:in `call'
config/initializers/100-quiet_logger.rb:23:in `call'
config/initializers/100-silence_logger.rb:31:in `call'
lib/middleware/enforce_hostname.rb:23:in `call'
lib/middleware/request_tracker.rb:198:in `call'

Backtrace

app/models/badge.rb:306:in `image_url'
active_model_serializers (0.8.4) lib/active_model/serializer.rb:99:in `block in attribute'
(eval):10:in `_fast_attributes'
active_model_serializers (0.8.4) lib/active_model/serializer.rb:468:in `rescue in attributes'
active_model_serializers (0.8.4) lib/active_model/serializer.rb:455:in `attributes'
active_model_serializers (0.8.4) lib/active_model/serializer.rb:480:in `_serializable_hash'
active_model_serializers (0.8.4) lib/active_model/serializer.rb:359:in `serializable_hash'
active_model_serializers (0.8.4) lib/active_model/serializer.rb:448:in `block in merge_association'
active_model_serializers (0.8.4) lib/active_model/serializer.rb:445:in `each'
active_model_serializers (0.8.4) lib/active_model/serializer.rb:445:in `merge_association'

Env

HTTP HOSTS: site.com

Hallo @f1r4s
Ich hatte das gleiche Problem. Konntest du dieses Problem lösen?

Ich glaube, das wurde in diesem Thema gelöst:

1 „Gefällt mir“