Skip to content
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

[Bug] Bookmark export doesn't truncate file on overwriting #3069

Open
danpla opened this issue Apr 15, 2023 · 1 comment
Open

[Bug] Bookmark export doesn't truncate file on overwriting #3069

danpla opened this issue Apr 15, 2023 · 1 comment

Comments

@danpla
Copy link

danpla commented Apr 15, 2023

Describe the bug

When the bookmarks export overwrites an existing HTML file larger than the exported one, the resulting file is not truncated, that is, it contains trailing data from the original file, and its size stays the same.

How to Reproduce

  1. Add some bookmarks to DDG and export them.
  2. Delete half of the bookmarks and export them again to the same file, confirming overwriting.
  3. Observe the size and contents of the file.

Expected behavior

It should truncate/delete the overwritten file on export.

Environment

- DDG App Version: 5.156
- Device: Armor X7
- OS: Android 10
@satvik2131
Copy link

satvik2131 commented May 6, 2023

Hi , I want to work on the issue and want to ask some questions as well can assign me the issue

malmstein pushed a commit that referenced this issue Oct 11, 2024
Task/Issue URL: #3069

### Description
In Android 10/11, the "w" write mode no longer truncates the file during
an overwrite. More details about this workaround can be found at
https://issuetracker.google.com/issues/180526528

### Steps to test this PR

1. Add some bookmarks to DDG and export them.
2. Delete half of the bookmarks and export them again to the same file,
confirming overwriting.
3. Observe the size and contents of the file.

<details>
<summary>Example non-truncated output pre-fix</summary>

```
<!DOCTYPE NETSCAPE-Bookmark-file-1>
<!--This is an automatically generated file.
It will be read and overwritten.
Do Not Edit! -->
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=UTF-8">
<Title>Bookmarks</Title>
<H1>Bookmarks</H1>
<DL><p>
    <DT><H3 ADD_DATE="1618844074" LAST_MODIFIED="1618844074" PERSONAL_TOOLBAR_FOLDER="true">DuckDuckGo Bookmarks</H3>
    <DL><p>
        <DT><A HREF="https://en.m.wikipedia.org/wiki/DuckDuckGo" ADD_DATE="1618844074" LAST_MODIFIED="1618844074">DuckDuckGo - Wikipedia</A>
    </DL><p>
</DL><p>
/en.m.wikipedia.org/wiki/DuckDuckGo" ADD_DATE="1618844074" LAST_MODIFIED="1618844074">DuckDuckGo - Wikipedia</A>
        <DT><A HREF="https://duckduckgo.com/about" ADD_DATE="1618844074" LAST_MODIFIED="1618844074">About DuckDuckGo</A>
    </DL><p>
</DL><p>

```

</details>

<details>
<summary>Example truncated output post-fix</summary>

```
<!DOCTYPE NETSCAPE-Bookmark-file-1>
<!--This is an automatically generated file.
It will be read and overwritten.
Do Not Edit! -->
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=UTF-8">
<Title>Bookmarks</Title>
<H1>Bookmarks</H1>
<DL><p>
    <DT><H3 ADD_DATE="1618844074" LAST_MODIFIED="1618844074" PERSONAL_TOOLBAR_FOLDER="true">DuckDuckGo Bookmarks</H3>
    <DL><p>
        <DT><A HREF="https://en.m.wikipedia.org/wiki/DuckDuckGo" ADD_DATE="1618844074" LAST_MODIFIED="1618844074">DuckDuckGo - Wikipedia</A>
    </DL><p>
</DL><p>
```

</details>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants