mobilizon_ynh icon indicating copy to clipboard operation
mobilizon_ynh copied to clipboard

No image after a change of url

Open zamentur opened this issue 10 months ago • 0 comments

Describe the bug

After a changeurl from mobilizon.sans-nuage.fr to hoplagenda.fr, all image are unreachable.

Context

  • Hardware: VPS
  • YunoHost version: 11.2
  • I have access to my server: ssh and webadmin
  • Are you in a special context or did you perform some particular tweaking on your YunoHost instance?: yes
    • If yes, please explain: sans-nuage.fr server is a production server with several apps
  • Using, or trying to install package version/branch:
  • If upgrading, current package version: can be found in the admin, or with yunohost app info $app_id

Steps to reproduce

yunohost app install mobilizon --args "domain=mobilizon.sans-nuage.fr"
yunohost app change-url mobilizon -d hoplagenda.fr -p /

Expected behavior

The change-url should edit the hardcoded url inside the database.

Logs

mobilizon=# select * from medias;
   id   |                                                                                                                                                                                                                                                            file                                                                                                                                                                                                                                                            |     inserted_at     |     updated_at      | actor_id |                                                                     metadata                                                                      
--------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+---------------------+---------------------+----------+---------------------------------------------------------------------------------------------------------------------------------------------------
  88208 | {"id": "879dc8b0-c8ef-46f6-b2de-aef31f37c071", "url": "https://hoplagenda.fr/media/537a170f4a0175b9e21e94964869a8c98614be44cd5a7c83efb7b95535520408.jpg?name=banniere%20finale.jpg", "name": "banniere finale.jpg", "size": 1243224, "updated_at": "2023-05-07T18:07:03", "inserted_at": "2023-05-07T18:07:03", "content_type": "image/jpeg"}

Solution

UPDATE  medias SET file=REPLACE(file::text, 'https://mobilizon.sans-nuage.fr', 'https://hoplagenda.fr')::jsonb;
UPDATE resource SET url=REPLACE(url, 'https://mobilizon.sans-nuage.fr', 'https://hoplagenda.fr');
DELETE FROM actors WHERE preferred_username='anonymous' and url LIKE '%https://mobilizon.sans-nuage.fr%';
UPDATE actors SET 
url=REPLACE(url, 'https://mobilizon.sans-nuage.fr', 'https://hoplagenda.fr'),
inbox_url=REPLACE(inbox_url, 'https://mobilizon.sans-nuage.fr', 'https://hoplagenda.fr'),
outbox_url=REPLACE(outbox_url, 'https://mobilizon.sans-nuage.fr', 'https://hoplagenda.fr'),
following_url=REPLACE(following_url, 'https://mobilizon.sans-nuage.fr', 'https://hoplagenda.fr'),
followers_url=REPLACE(followers_url, 'https://mobilizon.sans-nuage.fr', 'https://hoplagenda.fr'),
shared_inbox_url=REPLACE(shared_inbox_url, 'https://mobilizon.sans-nuage.fr', 'https://hoplagenda.fr'),
avatar=REPLACE(avatar::text, 'https://mobilizon.sans-nuage.fr', 'https://hoplagenda.fr')::jsonb,
banner=REPLACE(banner::text, 'https://mobilizon.sans-nuage.fr', 'https://hoplagenda.fr')::jsonb,
members_url=REPLACE(members_url, 'https://mobilizon.sans-nuage.fr', 'https://hoplagenda.fr'),
resources_url=REPLACE(resources_url, 'https://mobilizon.sans-nuage.fr', 'https://hoplagenda.fr'),
todos_url=REPLACE(todos_url, 'https://mobilizon.sans-nuage.fr', 'https://hoplagenda.fr'),
posts_url=REPLACE(posts_url, 'https://mobilizon.sans-nuage.fr', 'https://hoplagenda.fr'),
events_url=REPLACE(events_url, 'https://mobilizon.sans-nuage.fr', 'https://hoplagenda.fr'),
discussions_url=REPLACE(discussions_url, 'https://mobilizon.sans-nuage.fr', 'https://hoplagenda.fr');

zamentur avatar Apr 19 '24 08:04 zamentur