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

Truncate export bookmarks file on overwrite #4371

Conversation

alenz316
Copy link
Contributor

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.
Example non-truncated output pre-fix
<!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>

Example truncated output post-fix
<!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>

In Android 10/11, the "w" write mode no longer truncates the file during
a file overwrite. More details about this workaround can be found at
https://issuetracker.google.com/issues/180526528
@malmstein malmstein enabled auto-merge (squash) October 11, 2024 22:37
@malmstein malmstein self-assigned this Oct 11, 2024
@malmstein malmstein merged commit e7c193a into duckduckgo:develop Oct 11, 2024
1 check failed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants