• [^] # Re: Validation des liens et bookmarks

    Posté par (site web personnel, Mastodon) . En réponse à l’entrée du suivi Corruption de dépêches et URL avec des caractères non ascii. Évalué à 2 (+0/-0).

    Mince, visiblement, ça ne suffit pas.

    Avec le Pull Request, si je fais une réorganisation avec un lien invalide: il n'y a plus d'exception levée, mais le save ne passe pas et, du coup, il n'y a pas de nouvelle version crée.

    Par contre, le résultat est que la news est bien complètement sauvée (les paragraphes sont bien présents).

    Les logs pour info:

    linuxfr.org_1 | Started PUT "/redaction/news/voici-venu-le-temps-des-cathedrales-libres/reorganized" for 172.18.0.8 at 2021年05月31日 21:12:35 +0000
    linuxfr.org_1 | Cannot render console from 172.18.0.1! Allowed networks: 127.0.0.1, ::1, 127.0.0.0/127.255.255.255
    linuxfr.org_1 | Processing by Redaction::NewsController#reorganized as HTML
    linuxfr.org_1 | Parameters: {"utf8"=>"✓", "authenticity_token"=>"6rSwmgRGKjCj0-SWOLShHi7bJqCxOYIsP25mJAIcrq7xAz_y1sahDTRQl14RnG2EEb34l6Q_gCIj2Dx0dQpPgg", "news"=>{"section_id"=>"1", "title"=>"Voici venu le temps des cathédrales libres", "wiki_body"=>"test chapeau :)\r\n\r\n\r\n\r\ntest\r\nt\r\n\r\n\r\n\r\ntest2222", "links_attributes"=>{"0"=>{"title"=>"http://localhost", "url"=>"http://localhost", "lang"=>"fr", "id"=>"9"}, "1"=>{"title"=>"http://localhost", "url"=>"http://localhost/asdfjkl", "lang"=>"fr", "id"=>"10"}, "2"=>{"title"=>"http://localhost", "url"=>"http://localhost/éééééé", "lang"=>"fr", "id"=>"11"}}, "wiki_second_part"=>"Un sommaire sera automatiquement créé si nécessaire. Pensez à l'orthographe et aux liens explicatifs vers Wikipedia. (Vous pouvez éditer ce paragraphe en cliquant sur le crayon !)\r\n\r\n\r\n\r\ntest\r\n\r\n\r\n\r\nCe paragraphe est chou :) test\r\n\r\n\r\n\r\nVous pouvez éditer ce paragraphe en cliquant sur le crayon ! http://localhost/ééééééé test\r\n\r\n\r\n\r\nVous pouvez éditer ce paragraphe en cliquant sur le crayon ! test\r\n\r\naésldkjfaséldkjf"}, "commit"=>"OK", "id"=>"voici-venu-le-temps-des-cathedrales-libres"}
    linuxfr.org_1 | Account Load (0.3ms) SELECT `accounts`.* FROM `accounts` WHERE `accounts`.`id` = 4 ORDER BY `accounts`.`id` ASC LIMIT 1
    nginx_1 | 172.18.0.1 - - [31/May/2021:21:12:36 +0000] "POST /redaction/news/voici-venu-le-temps-des-cathedrales-libres/reorganized HTTP/1.1" 302 149 "http://dlfp.lo/redaction/news/voici-venu-le-temps-des-cathedrales-libres/reorganize" "Mozilla/5.0 (X11; Linux x86_64; rv:88.0) Gecko/20100101 Firefox/88.0" "-"
    linuxfr.org_1 | News Load (0.2ms) SELECT `news`.* FROM `news` WHERE `news`.`cached_slug` = 'voici-venu-le-temps-des-cathedrales-libres' LIMIT 1
    linuxfr.org_1 | (0.2ms) BEGIN
    linuxfr.org_1 | Paragraph Destroy (0.7ms) DELETE FROM `paragraphs` WHERE `paragraphs`.`news_id` = 4
    linuxfr.org_1 | Link Load (0.3ms) SELECT `links`.* FROM `links` WHERE `links`.`news_id` = 4 AND `links`.`id` IN (9, 10, 11)
    linuxfr.org_1 | Paragraph Load (0.5ms) SELECT `paragraphs`.* FROM `paragraphs` WHERE `paragraphs`.`news_id` = 4 AND (`paragraphs`.`position` IS NOT NULL) ORDER BY `paragraphs`.`position` DESC LIMIT 1
    linuxfr.org_1 | Paragraph Create (0.3ms) INSERT INTO `paragraphs` (`news_id`, `position`, `second_part`, `body`, `wiki_body`) VALUES (4, 1, FALSE, '<p>test chapeau :)</p>\n', 'test chapeau :)\r\n\r\n')
    linuxfr.org_1 | Paragraph Load (0.6ms) SELECT `paragraphs`.* FROM `paragraphs` WHERE `paragraphs`.`news_id` = 4 AND (`paragraphs`.`position` IS NOT NULL) ORDER BY `paragraphs`.`position` DESC LIMIT 1
    linuxfr.org_1 | Paragraph Create (0.4ms) INSERT INTO `paragraphs` (`news_id`, `position`, `second_part`, `body`, `wiki_body`) VALUES (4, 2, FALSE, '<p>test<br>\nt</p>\n', 'test\r\nt\r\n\r\n')
    linuxfr.org_1 | Paragraph Load (0.6ms) SELECT `paragraphs`.* FROM `paragraphs` WHERE `paragraphs`.`news_id` = 4 AND (`paragraphs`.`position` IS NOT NULL) ORDER BY `paragraphs`.`position` DESC LIMIT 1
    linuxfr.org_1 | Paragraph Create (0.3ms) INSERT INTO `paragraphs` (`news_id`, `position`, `second_part`, `body`, `wiki_body`) VALUES (4, 3, FALSE, '<p>test2222</p>\n', 'test2222')
    linuxfr.org_1 | Paragraph Load (0.7ms) SELECT `paragraphs`.* FROM `paragraphs` WHERE `paragraphs`.`news_id` = 4 AND (`paragraphs`.`position` IS NOT NULL) ORDER BY `paragraphs`.`position` DESC LIMIT 1
    linuxfr.org_1 | Paragraph Create (0.7ms) INSERT INTO `paragraphs` (`news_id`, `position`, `second_part`, `body`, `wiki_body`) VALUES (4, 4, TRUE, '<p>Un sommaire sera automatiquement créé si nécessaire. Pensez à l\'orthographe et aux liens explicatifs vers Wikipedia. (Vous pouvez éditer ce paragraphe en cliquant sur le crayon !)</p>\n', 'Un sommaire sera automatiquement créé si nécessaire. Pensez à l\'orthographe et aux liens explicatifs vers Wikipedia. (Vous pouvez éditer ce paragraphe en cliquant sur le crayon !)\r\n\r\n')
    linuxfr.org_1 | Paragraph Load (0.6ms) SELECT `paragraphs`.* FROM `paragraphs` WHERE `paragraphs`.`news_id` = 4 AND (`paragraphs`.`position` IS NOT NULL) ORDER BY `paragraphs`.`position` DESC LIMIT 1
    linuxfr.org_1 | Paragraph Create (0.3ms) INSERT INTO `paragraphs` (`news_id`, `position`, `second_part`, `body`, `wiki_body`) VALUES (4, 5, TRUE, '<p>test</p>\n', 'test\r\n\r\n')
    linuxfr.org_1 | Paragraph Load (1.0ms) SELECT `paragraphs`.* FROM `paragraphs` WHERE `paragraphs`.`news_id` = 4 AND (`paragraphs`.`position` IS NOT NULL) ORDER BY `paragraphs`.`position` DESC LIMIT 1
    linuxfr.org_1 | Paragraph Create (0.4ms) INSERT INTO `paragraphs` (`news_id`, `position`, `second_part`, `body`, `wiki_body`) VALUES (4, 6, TRUE, '<p>Ce paragraphe est chou :) test</p>\n', 'Ce paragraphe est chou :) test\r\n\r\n')
    linuxfr.org_1 | Paragraph Load (0.6ms) SELECT `paragraphs`.* FROM `paragraphs` WHERE `paragraphs`.`news_id` = 4 AND (`paragraphs`.`position` IS NOT NULL) ORDER BY `paragraphs`.`position` DESC LIMIT 1
    linuxfr.org_1 | Paragraph Create (0.7ms) INSERT INTO `paragraphs` (`news_id`, `position`, `second_part`, `body`, `wiki_body`) VALUES (4, 7, TRUE, '<p>Vous pouvez éditer ce paragraphe en cliquant sur le crayon ! <a href=\"http://localhost/%C3%A9%C3%A9%C3%A9%C3%A9%C3%A9%C3%A9%C3%A9\">http://localhost/ééééééé</a> test</p>\n', 'Vous pouvez éditer ce paragraphe en cliquant sur le crayon ! http://localhost/ééééééé test\r\n\r\n')
    linuxfr.org_1 | Paragraph Load (0.6ms) SELECT `paragraphs`.* FROM `paragraphs` WHERE `paragraphs`.`news_id` = 4 AND (`paragraphs`.`position` IS NOT NULL) ORDER BY `paragraphs`.`position` DESC LIMIT 1
    linuxfr.org_1 | Paragraph Create (0.3ms) INSERT INTO `paragraphs` (`news_id`, `position`, `second_part`, `body`, `wiki_body`) VALUES (4, 8, TRUE, '<p>Vous pouvez éditer ce paragraphe en cliquant sur le crayon ! test</p>\n', 'Vous pouvez éditer ce paragraphe en cliquant sur le crayon ! test\r\n')
    linuxfr.org_1 | Paragraph Load (0.6ms) SELECT `paragraphs`.* FROM `paragraphs` WHERE `paragraphs`.`news_id` = 4 AND (`paragraphs`.`position` IS NOT NULL) ORDER BY `paragraphs`.`position` DESC LIMIT 1
    linuxfr.org_1 | Paragraph Create (0.5ms) INSERT INTO `paragraphs` (`news_id`, `position`, `second_part`, `body`, `wiki_body`) VALUES (4, 9, TRUE, '<p>aésldkjfaséldkjf</p>\n', 'aésldkjfaséldkjf')
    linuxfr.org_1 | Link Load (0.4ms) SELECT `links`.* FROM `links` WHERE `links`.`news_id` = 4
    linuxfr.org_1 | Paragraph Load (0.5ms) SELECT `paragraphs`.* FROM `paragraphs` WHERE `paragraphs`.`news_id` = 4 AND `paragraphs`.`second_part` = FALSE ORDER BY `paragraphs`.`position` ASC
    linuxfr.org_1 | Paragraph Load (0.4ms) SELECT `paragraphs`.* FROM `paragraphs` WHERE `paragraphs`.`news_id` = 4 AND `paragraphs`.`second_part` = TRUE ORDER BY `paragraphs`.`position` ASC
    linuxfr.org_1 | Section Load (0.5ms) SELECT `sections`.* FROM `sections` WHERE `sections`.`id` = 1 LIMIT 1
    linuxfr.org_1 | (1.8ms) COMMIT
    

    On voit bien que je n'ai plus d'exception, car j'ai le COMMIT SQL qui est exécuté.

    Mais aucun lien n'a été mis à jour (sûrement à cause du validator d'url) et aucune version n'a été crée.