Skip to content

dc_set_config("selfavatar", "/path/to/image.png") incorrect on windows #116

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
ralphtheninja opened this issue Jun 3, 2019 · 10 comments
Closed
Labels
bug Something is not working needs-retry

Comments

@ralphtheninja
Copy link
Collaborator

ralphtheninja commented Jun 3, 2019

Background: I do dc_set_config("selfavatar", "/some/path/avatar.png") and when I get the value back via dc_get_config("selfavatar") it points to a path in the blob dir that contains a forward slash e.g.: (from integration tests in node bindings)

not ok 13 selfAvatar correct
  ---
    operator: equal
    expected: |-
      'C:\\Users\\User\\AppData\\Local\\Temp\\fb85cb643f6173c334492ed417daff90\\db.sqlite-blobs\\avatar.png'
    actual: |-
      'C:\\Users\\User\\AppData\\Local\\Temp\\fb85cb643f6173c334492ed417daff90\\db.sqlite-blobs/avatar.png'
    at: DeltaChat.dc.once (C:\Users\User\src\deltachat\deltachat-node\test\integration.js:62:7)
    stack: |-
      Error: selfAvatar correct
          at Test.assert [as _assert] (C:\Users\User\src\deltachat\deltachat-node\node_modules\tape\lib\test.js:226:54)
          at Test.bound [as _assert] (C:\Users\User\src\deltachat\deltachat-node\node_modules\tape\lib\test.js:77:32)
          at Test.equal (C:\Users\User\src\deltachat\deltachat-node\node_modules\tape\lib\test.js:386:10)
          at Test.bound [as is] (C:\Users\User\src\deltachat\deltachat-node\node_modules\tape\lib\test.js:77:32)
          at DeltaChat.dc.once (C:\Users\User\src\deltachat\deltachat-node\test\integration.js:62:7)
          at Object.onceWrapper (events.js:286:20)
          at DeltaChat.emit (events.js:198:13)
          at DeltaChat.ready (C:\Users\User\src\deltachat\deltachat-node\lib\deltachat.js:89:12)
          at Object.onceWrapper (events.js:286:20)
          at DeltaChat.emit (events.js:198:13)

dc_get_config() in turn calls dc_get_abs_path() which contains the bug (guessing).

@ralphtheninja
Copy link
Collaborator Author

We should first write a failing test for this.

@dignifiedquire Question is how to write it for multiple platforms. Can you have different assert_eq!() depending on the platform?

@dignifiedquire
Copy link
Collaborator

why should this test be different on different platforms? it should use os independent path separators and abstractions in rust.

@ralphtheninja
Copy link
Collaborator Author

That makes more sense obviously. Where do I start looking?

@dignifiedquire
Copy link
Collaborator

dignifiedquire commented Jun 7, 2019 via email

@dignifiedquire
Copy link
Collaborator

dignifiedquire commented Jun 7, 2019 via email

@ralphtheninja
Copy link
Collaborator Author

Actually, it seems dc_get_abs_path() is correct. It's how it's used by the core that's incorrect.

@ralphtheninja ralphtheninja changed the title dc_get_abs_path() incorrect on windows dc_set_config("selfavatar", "/path/to/image.png") incorrect on windows Jun 7, 2019
@r10s
Copy link
Contributor

r10s commented Jun 8, 2019

just some background: dc_set_config(context, "selfavatar", "/gallery/image.jpg") does not only save the given string in the database. it creates a physical copy of the given image-file to the blob-directory and stores that as $BLOBDIR/image.jpg.

when calling dc_set_config(context, "selfavatar"), $BLOBDIR is expanded to the current blob directory automatically so that the ui should be able to use all paths directly. return value may be eg /home/user/somemailbox.db-blobs/image.jpg.

@hpk42
Copy link
Contributor

hpk42 commented Jul 24, 2019

See also the tentatively closed #135

@hpk42
Copy link
Contributor

hpk42 commented Aug 14, 2019

could you retry if this is still an issue on master? there are a lot of changes/improvements that might have resolved it.

@hpk42
Copy link
Contributor

hpk42 commented Oct 2, 2019

k, closing as it's likely fixed and nobody gets back.

@hpk42 hpk42 closed this as completed Oct 2, 2019
@r10s r10s added the bug Something is not working label Aug 12, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something is not working needs-retry
Projects
None yet
Development

No branches or pull requests

4 participants