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

master
andryyy 2020-11-09 14:42:26 +01:00
parent 5e1ae49477
commit 6d56ef6435
No known key found for this signature in database
GPG Key ID: 8EC34FF2794E25EF
4 changed files with 60 additions and 8 deletions

View File

@ -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);
}
}
?>

View File

@ -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 }}

View File

@ -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();
}
}
});
});

View File

@ -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();
}
}
});
});