Skip to content

Commit

Permalink
Explicitly handle missing padding in generic dezoom
Browse files Browse the repository at this point in the history
  • Loading branch information
lovasoa committed Jul 3, 2020
1 parent ebba8a0 commit 969552a
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion dezoomers/generic.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@ var generic_viewer = (function () {
var coordinateRegex = /\{\{([XY])(?::(.)(\d+))?\}\}/gi;
function fillTemplate(tpl, coords) {
return tpl.replace(coordinateRegex, function (base, coord, padding, widthStr) {
var width = widthStr | 0;
var padding = padding || "";
var n = coords[coord.toLowerCase()];
var width = parseInt(widthStr);
var result = n.toString();
while (result.length < width) {
result = padding + result;
Expand Down

0 comments on commit 969552a

Please sign in to comment.