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] ios导入大备份json文件失败,以及临时解决方法 #4533

Open
1 of 3 tasks
jiangying000 opened this issue Apr 17, 2024 · 5 comments
Open
1 of 3 tasks
Labels
bug Something isn't working

Comments

@jiangying000
Copy link

jiangying000 commented Apr 17, 2024

Bug Description

同步了目前最新的代码部署后

从windows11 chrome导出,接着导入ios 17 的chrome的时候,报【导入失败】
我查看了 json,没有发现什么异常

导出的文件大小 3112 KB,(看起来没有超过localStorage 5MB的限制)

失败后,有个报错界面显示:
quotaexceedederror: the quota has been exceeded.
后面一堆 堆栈

基本确定是 ios 的浏览器的问题,桌面端的firefox,chrome导入这个文件都没问题

Steps to Reproduce

导出大的备份文件,比如 > 5M
在 ios chrome导入这个json文件

导入失败,提示 quotaexceedederror: the quota has been exceeded.

Expected Behavior

应该导入成功

Screenshots

No response

Deployment Method

  • Docker
  • Vercel
  • Server

Desktop OS

No response

Desktop Browser

No response

Desktop Browser Version

No response

Smartphone Device

No response

Smartphone OS

No response

Smartphone Browser

No response

Smartphone Browser Version

No response

Additional Logs

No response

@jiangying000 jiangying000 added the bug Something isn't working label Apr 17, 2024
@nextchat-manager
Copy link

Please follow the issue template to update description of your issue.

@Issues-translate-bot
Copy link

Bot detected the issue body's language is not English, translate it automatically.


Title: [Bug]

@jiangying000 jiangying000 changed the title [Bug] [Bug] 导入大文件失败 Apr 17, 2024
@jiangying000 jiangying000 changed the title [Bug] 导入大文件失败 [Bug] ios导入大备份json文件失败,已经临时解决方法 Apr 17, 2024
@jiangying000 jiangying000 changed the title [Bug] ios导入大备份json文件失败,已经临时解决方法 [Bug] ios导入大备份json文件失败,以及临时解决方法 Apr 17, 2024
@jiangying000
Copy link
Author

临时解决方法是修改json限制session数量,再保存

import json

# 原始文件路径
original_file_path = r'xxxxPM.json'
# 新文件路径
new_file_path = r'yyyPM_limited.json'

# 加载JSON数据
try:
    with open(original_file_path, 'r', encoding='utf-8') as file:
        data = json.load(file)
    print("原始JSON文件加载成功。")

    # 限制 'chat-next-web-store' 键下的列表为100条
    data['chat-next-web-store']['sessions'] = data['chat-next-web-store']['sessions'][:100]

    # 将修改后的数据保存到新文件
    with open(new_file_path, 'w', encoding='utf-8') as new_file:
        json.dump(data, new_file, ensure_ascii=False, indent=4)
    print(f"限制后的数据已保存到新文件:{new_file_path}")

except FileNotFoundError:
    print(f"原始文件{original_file_path}未找到。")
except json.JSONDecodeError:
    print(f"原始文件{original_file_path}不是有效的JSON格式。")
except Exception as e:
    print(f"处理文件时发生错误:{e}")

@Dean-YZG
Copy link
Contributor

感谢反馈,会尽快解决这个问题

@Issues-translate-bot
Copy link

Bot detected the issue body's language is not English, translate it automatically.


Thanks for the feedback, we will solve this problem as soon as possible

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants