[GH-ISSUE #56] Exporting strings with multiple slashes #40

Closed
opened 2026-05-23 08:27:41 -06:00 by gitea-mirror · 1 comment
Owner

Originally created by @appy-one on GitHub (Dec 29, 2021).
Original GitHub issue: https://github.com/appy-one/acebase/issues/56

Originally assigned to: @appy-one on GitHub.

When exporting strings that contains backslashes, the first one is doubled in the exported value:

var { AceBase } = require("acebase")
const db = new AceBase('test');
await db.ref('export').set({ text: 'Strings with multiple \\ backslashes \\ are not \\ exported ok' });
let json = '';
await db.ref('export').export({ write: str => json += str });

After execution, the value of json is {"text":"Strings with multiple \\ backslashes \ are not \ exported ok"}.
The expected value is {"text":"Strings with multiple \ backslashes \ are not \ exported ok"}.

The issue is caused by the escape function in the exportNode method in storage.js, which does a regexp replace on the first occurrence of a backslash

Will be fixed soon

Originally created by @appy-one on GitHub (Dec 29, 2021). Original GitHub issue: https://github.com/appy-one/acebase/issues/56 Originally assigned to: @appy-one on GitHub. When exporting strings that contains backslashes, the first one is doubled in the exported value: ```js var { AceBase } = require("acebase") const db = new AceBase('test'); await db.ref('export').set({ text: 'Strings with multiple \\ backslashes \\ are not \\ exported ok' }); let json = ''; await db.ref('export').export({ write: str => json += str }); ``` After execution, the value of `json` is `{"text":"Strings with multiple \\ backslashes \ are not \ exported ok"}`. The expected value is `{"text":"Strings with multiple \ backslashes \ are not \ exported ok"}`. The issue is caused by the `escape` function in the `exportNode` method in *storage.js*, which does a regexp replace on the first occurrence of a backslash Will be fixed soon
gitea-mirror 2026-05-23 08:27:41 -06:00
  • closed this issue
  • added the
    bug
    label
Author
Owner

@appy-one commented on GitHub (Dec 31, 2021):

Fix published in acebase v1.13.0

<!-- gh-comment-id:1003379875 --> @appy-one commented on GitHub (Dec 31, 2021): Fix published in acebase v1.13.0
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: github-starred/acebase#40
No description provided.