]> git.immae.eu Git - github/wallabag/wallabag.git/blobdiff - src/Wallabag/CoreBundle/Helper/ContentProxy.php
Merge pull request #3215 from wallabag/fix-3192
[github/wallabag/wallabag.git] / src / Wallabag / CoreBundle / Helper / ContentProxy.php
index e4e7fb3183c4bbbabc98918c6f8ba02e69990dee..51bb2ca2d73e4cbc447f8c4fcdb7502cd5e1d767 100644 (file)
@@ -120,12 +120,12 @@ class ContentProxy
 
         $this->validateAndSetLanguage(
             $entry,
-            isset($content['language']) ? $content['language'] : ''
+            isset($content['language']) ? $content['language'] : null
         );
 
         $this->validateAndSetPreviewPicture(
             $entry,
-            isset($content['open_graph']['og_image']) ? $content['open_graph']['og_image'] : ''
+            isset($content['open_graph']['og_image']) ? $content['open_graph']['og_image'] : null
         );
 
         // if content is an image, define it as a preview too
@@ -174,6 +174,10 @@ class ContentProxy
      */
     private function validateAndSetLanguage($entry, $value)
     {
+        // some lang are defined as fr-FR, es-ES.
+        // replacing - by _ might increase language support
+        $value = str_replace('-', '_', $value);
+
         $errors = $this->validator->validate(
             $value,
             (new LocaleConstraint())