NobGit
public nobgit read

NobMail

Based on mailcow: dockerized

Languages

Repository composition by tracked source files.

PHP
PHP 49% JavaScript 35% HTML 9% CSS 4% Shell 2% Python 1% Lua 0% Perl 0% Ruby 0% SCSS 0%
Create file Wiki Documentation
Clone
https://nobgit.com/orgs/nobgit/nobmail.git
ssh://[email protected]:2222/orgs/nobgit/nobmail.git

Commit

[Web] Fix invalid encodings with json_encode, fixes #3847

6d56ef64
andryyy <[email protected]> 6 years ago
data/web/inc/ajax/qitem_details.php                |  2 +
 .../.github/workflows/main.yml                     | 45 ++++++++++++++++++++++
 data/web/js/site/qhandler.js                       | 10 +++--
 data/web/js/site/quarantine.js                     | 11 ++++--
 4 files changed, 60 insertions(+), 8 deletions(-)
 create mode 100644 data/web/inc/lib/vendor/php-mime-mail-parser/php-mime-mail-parser/.github/workflows/main.yml

Diff

diff --git a/data/web/inc/ajax/qitem_details.php b/data/web/inc/ajax/qitem_details.php
index 5eca2319..63a9cf0d 100644
--- a/data/web/inc/ajax/qitem_details.php
+++ b/data/web/inc/ajax/qitem_details.php
@@ -197,7 +197,9 @@ elseif (!empty($_GET['id']) && ctype_alnum($_GET['id'])) {
         exit;
       }
     }
+    $data = mb_convert_encoding($data, "UTF-8", "auto");
     echo json_encode($data);
   }
+
 }
 ?>
diff --git a/data/web/inc/lib/vendor/php-mime-mail-parser/php-mime-mail-parser/.github/workflows/main.yml b/data/web/inc/lib/vendor/php-mime-mail-parser/php-mime-mail-parser/.github/workflows/main.yml
new file mode 100644
index 00000000..f1a947c1
--- /dev/null
+++ b/data/web/inc/lib/vendor/php-mime-mail-parser/php-mime-mail-parser/.github/workflows/main.yml
@@ -0,0 +1,45 @@
+name: CI
+
+on: [push]
+
+jobs:
+
+  tests:
+    runs-on: ubuntu-latest
+    strategy:
+      matrix:
+        php: [7.1, 7.2, 7.3]
+        composer: ["", "--prefer-lowest"]
+    steps:
+    - uses: actions/checkout@v1
+    - name: Change PHP version
+      run: sudo update-alternatives --set php /usr/bin/php${{ matrix.php }} && php -v
+    - name: Install mailparse
+      run: sudo apt install php-mailparse
+    - name: Composer update
+      run: composer update ${{ matrix.composer }} --no-progress
+    - name: PhpUnit
+      run: php -d xdebug.profiler_enable=off ./vendor/bin/phpunit
+     
+  php-cs:
+    runs-on: ubuntu-latest
+    steps:
+    - uses: actions/checkout@v1
+    - name: Composer update
+      run: composer update --no-progress --ignore-platform-reqs
+    - name: PHP CS
+      run: ./vendor/bin/phpcs src tests --standard=psr2
+     
+  coverage:
+    runs-on: ubuntu-latest
+    steps:
+    - uses: actions/checkout@v1
+    - name: Install mailparse
+      run: sudo apt install php-mailparse
+    - name: Composer update
+      run: composer update --no-progress
+    - name: Codecov
+      run: |
+        ./vendor/bin/phpunit --coverage-clover=coverage.xml --whitelist src
+        bash <(curl -s https://codecov.io/bash) -t ${{ secrets.COVERALLS_REPO_TOKEN }}
+     
diff --git a/data/web/js/site/qhandler.js b/data/web/js/site/qhandler.js
index a0534804..f2b71ff6 100644
--- a/data/web/js/site/qhandler.js
+++ b/data/web/js/site/qhandler.js
@@ -6,10 +6,6 @@ jQuery(function($){
     data: { hash: qitem },
     dataType: 'json',
     success: function(data){
-      if (typeof data.error !== 'undefined') {
-        qError.text(data.error);
-        qError.show();
-      }
       $('[data-id="qitems_single"]').each(function(index) {
         $(this).attr("data-item", qitem);
       });
@@ -62,6 +58,12 @@ jQuery(function($){
           $('#qid_detail_recipients').append(elem);
         });
       }
+    },
+    error: function(data){
+      if (typeof data.error !== 'undefined') {
+        qError.text("Error loading quarantine item");
+        qError.show();
+      }
     }
   });
 });
\ No newline at end of file
diff --git a/data/web/js/site/quarantine.js b/data/web/js/site/quarantine.js
index 5728c885..b68f0cb9 100644
--- a/data/web/js/site/quarantine.js
+++ b/data/web/js/site/quarantine.js
@@ -139,10 +139,7 @@ jQuery(function($){
       data: { id: qitem },
       dataType: 'json',
       success: function(data){
-        if (typeof data.error !== 'undefined') {
-          qError.text(data.error);
-          qError.show();
-        }
+
         $('[data-id="qitems_single"]').each(function(index) {
           $(this).attr("data-item", qitem);
         });
@@ -211,6 +208,12 @@ jQuery(function($){
         else {
           qAtts.text('-');
         }
+      },
+      error: function(data){
+        if (typeof data.error !== 'undefined') {
+          qError.text("Error loading quarantine item");
+          qError.show();
+        }
       }
     });
   });