Skip to content

Commit 33b401a

Browse files
authored
fix: cleaning special chars from order notes on export
1 parent e1e69ce commit 33b401a

File tree

1 file changed

+10
-1
lines changed
  • functions/lib/integration/parsers/order-to-tiny

1 file changed

+10
-1
lines changed

functions/lib/integration/parsers/order-to-tiny/index.js

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,16 @@ module.exports = (order, appData, storeId) => {
185185
}
186186

187187
if (order.notes) {
188-
tinyOrder.obs = order.notes.substring(0, 100)
188+
let cleanNotes = ''
189+
for (let i = 0; i < order.notes.length; i++) {
190+
if (order.notes.charCodeAt(i) <= 255) {
191+
cleanNotes += order.notes.charAt(i)
192+
if (cleanNotes.length > 99) break
193+
}
194+
}
195+
if (cleanNotes) {
196+
tinyOrder.obs = cleanNotes
197+
}
189198
}
190199
if (order.extra_discount && order.extra_discount.discount_coupon) {
191200
tinyOrder.obs = `${(tinyOrder.obs || '')} - ${order.extra_discount.discount_coupon}`.substring(0, 100)

0 commit comments

Comments
 (0)