[FIX] web: 'image_small' field not displayed for non-latin translations
Before this commit, images in kanban view of the Contact app were not displayed on non-latin languages, such as Russian. This was caused by the is_bin_size helper that wrongly assumes that a certain string is not a binary size, although it is (e.g. 64.2 Кб). This commit fixes the issue by including such strings as valid binary sizes. Bug found and fixed by @true-datura Test by @alexkuhn closes #23526 closes #22519
This commit is contained in:
committed by
Alexandre Kühn
parent
6faf7784e6
commit
67f67b5124
@@ -228,7 +228,7 @@ var utils = {
|
||||
* @returns {boolean}
|
||||
*/
|
||||
is_bin_size: function (v) {
|
||||
return (/^\d+(\.\d*)? \w+$/).test(v);
|
||||
return (/^\d+(\.\d*)? [^0-9]+$/).test(v);
|
||||
},
|
||||
/**
|
||||
* @param {any} node
|
||||
|
||||
@@ -44,6 +44,17 @@ QUnit.module('core', {}, function () {
|
||||
assert.strictEqual(intersperse("12345678", [3,0], '.'), '12.345.678');
|
||||
});
|
||||
|
||||
QUnit.test('is_bin_size', function (assert) {
|
||||
assert.expect(3);
|
||||
|
||||
var is_bin_size = utils.is_bin_size;
|
||||
|
||||
assert.strictEqual(is_bin_size('Cg=='), false);
|
||||
assert.strictEqual(is_bin_size('2.5 Mb'), true);
|
||||
// should also work for non-latin languages (e.g. russian)
|
||||
assert.strictEqual(is_bin_size('64.2 Кб'), true);
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
Reference in New Issue
Block a user