dragonflagon-fvtt icon indicating copy to clipboard operation
dragonflagon-fvtt copied to clipboard

DF Chat Archive - Unable to access Archive.

Open Lukasrygh23 opened this issue 2 years ago • 13 comments

Module DF Chat Enhancements 4.1.0 - Archive feature

**Describe the Issue ** Hi! This module is really useful, but the chat archive feature doesn't seem to work for me.

What steps did you take before experiencing the problem? Steps to reproduce the behavior:

  1. Click on "Archive Chat log" in the chat window
  2. Create a chatlog (any amount of chat selected)
  3. Go to "Manage Chat Archives" in settings
  4. Click any archive in there, including the one just created.

What did you expect to happen? A chatlog to appear that I could access through Foundry.

What happened instead? I recieved an "Unexpected character" error and several other errors, all reproduced below.

Screenshots The Error I got when attempting to open the chatlog originally. The current error. Error with all modules except DF chat disabled. Unsure if this is related but dumping it anyway.

Foundry Versions

  • Version of this module: 4.1.0
  • Foundry Version: V10 Build 287
  • System Name and Version: Oracle Cloud host, accessed via windows 10.
  • Browser Name and Version: Firefox and Chrome both tested.

What other modules did you have active when experiencing this issue (include both names and versions)? Full list of active modules as of most recent test. Without all modules I get a slightly different error.

Additional context I've tested this on a fresh foundry install and it seems to function, so I'm not quite sure what's causing the incompatability or if it's something in my old chat archives. Full list of active modules as of most recent test.

I used ViNo in V9 but have since disabled and uninstalled it.

I've tested by posting several messages in the recent chat and ONLY archiving those, and it seems to display fine. I can provide the JSON archives creating the errors but would rather not upload publicly, as they contain NSFW content and I don't quite know what github's policy is.

Lukasrygh23 avatar Nov 02 '22 16:11 Lukasrygh23

I am experiencing this on a new install with foundry v10, although my error messages are different.

image

The archive in question is a single chat message, although I do have a lot of other modules enabled.

After some further testing, I've determined that it does NOT like spaces in the chat archive name. Perhaps making these into -s instead of %20s would be a good solution here?

darloth avatar Nov 10 '22 23:11 darloth

Followup comment, mostly to @Lukasrygh23 - if you make a chat archive with no spaces in the name, you can rename it in foundry to something with spaces, using the chat archive rename feature even, and the file on disk will still have no spaces and load fine.

darloth avatar Nov 10 '22 23:11 darloth

I can create new logs without spaces and they work fine, but I couldn't salvage the old ones even by renaming them to space-less names. Thanks, Darloth!

Lukasrygh23 avatar Nov 11 '22 00:11 Lukasrygh23

This seems to be the main issue, given that the first JSON error only appears once.

image

MrVauxs avatar Nov 17 '22 23:11 MrVauxs

As a note, you can do the following in the console. game.settings.get("df-chat-enhance", "logs") gets you all of the archives data in the module. You can then modify this array of archive objects, and use await game.settings.set("df-chat-enhance", "logs") to apply it. Done properly, it can fix your archives. Will investigate further.

MrVauxs avatar Nov 17 '22 23:11 MrVauxs

Please note I am not responsible if this breaks your archives. A step by step solution to making your archives work:

  1. Copy paste this into the console.
let originalSettings = game.settings.get("df-chat-enhance", "logs")
console.log("These are the original settings", originalSettings)
originalSettings.map(x => { x.filepath = x.filepath.replaceAll("%20", "%2520").replaceAll("%25%25", "%25"); return x})
console.log("Modifying the settings to...", originalSettings)
await game.settings.set("df-chat-enhance", "logs", originalSettings)
  1. Open your archives!

NOTE THAT THIS APPLIES TO ALL ARCHIVES, WORKING OR NOT. WHILE IT SHOULD NOT BREAK ANY ALREADY-WORKING ARCHIVES, IF YOU WANT TO ONLY FIX A SPECIFIC ARCHIVE, YOU NEED TO MODIFY ONLY THAT ARCHIVES originalSettings

You can also use this method to change other attributes, such as names or visibility options, just edit originalSettings and to apply the changes, await game.settings.set("df-chat-enhance", "logs", originalSettings)

MrVauxs avatar Nov 18 '22 00:11 MrVauxs

This issue is still occurring... Also happens with newly created archives. At the very least, the ability to name a new archive using spaces should be disabled or prevented in some way so that new archives can't be created like this.

guldelox avatar May 22 '23 21:05 guldelox

The modules are unmaintained for a while now, and the fix is already made. It's just a matter of updating the module unfortunately.

MrVauxs avatar May 22 '23 21:05 MrVauxs

Please note I am not responsible if this breaks your archives. A step by step solution to making your archives work:

1. Copy paste this into the console.
let originalSettings = game.settings.get("df-chat-enhance", "logs")
console.log("These are the original settings", originalSettings)
originalSettings.map(x => { x.filepath = x.filepath.replaceAll("%20", "%2520").replaceAll("%25%25", "%25"); return x})
console.log("Modifying the settings to...", originalSettings)
await game.settings.set("df-chat-enhance", "logs", originalSettings)
2. Open your archives!

NOTE THAT THIS APPLIES TO ALL ARCHIVES, WORKING OR NOT. WHILE IT SHOULD NOT BREAK ANY ALREADY-WORKING ARCHIVES, IF YOU WANT TO ONLY FIX A SPECIFIC ARCHIVE, YOU NEED TO MODIFY ONLY THAT ARCHIVES originalSettings

You can also use this method to change other attributes, such as names or visibility options, just edit originalSettings and to apply the changes, await game.settings.set("df-chat-enhance", "logs", originalSettings)

Unfortunately none of these seemed to work in Foundry VTT v11.307 which is unfortunate because this looks like a great module.

Geektasticdad avatar Aug 09 '23 17:08 Geektasticdad

Please note I am not responsible if this breaks your archives. A step by step solution to making your archives work:

  1. Copy paste this into the console.
let originalSettings = game.settings.get("df-chat-enhance", "logs")
console.log("These are the original settings", originalSettings)
originalSettings.map(x => { x.filepath = x.filepath.replaceAll("%20", "%2520").replaceAll("%25%25", "%25"); return x})
console.log("Modifying the settings to...", originalSettings)
await game.settings.set("df-chat-enhance", "logs", originalSettings)
  1. Open your archives!

NOTE THAT THIS APPLIES TO ALL ARCHIVES, WORKING OR NOT. WHILE IT SHOULD NOT BREAK ANY ALREADY-WORKING ARCHIVES, IF YOU WANT TO ONLY FIX A SPECIFIC ARCHIVE, YOU NEED TO MODIFY ONLY THAT ARCHIVES originalSettings

You can also use this method to change other attributes, such as names or visibility options, just edit originalSettings and to apply the changes, await game.settings.set("df-chat-enhance", "logs", originalSettings)

Thanks so much for this! I had a mild panic attack last night when I did a fresh archive/delete and didn't know not to use spaces. I can now get into the archive 😅❤️

LukasPrism avatar Jan 29 '24 22:01 LukasPrism

@MrVauxs sorry to disturb but you're probably the only one able to answer this. I have some old chat archives that are in the archive folder but aren't showing up in the UI. Is there a way I can 'relink' them so they show up in the UI? This is an old world that's been through some migrations, not sure at what point they disappeared.

Thanks again for the above btw.

LukasPrism avatar Jan 31 '24 01:01 LukasPrism

Yes. You'd have to update the settings to include a new entry linking to the filepath of the archive, or modify an existing one to instead link to that file.

MrVauxs avatar Jan 31 '24 02:01 MrVauxs

Thanks! Makes sense. The JS to do so is beyond me... but I might try making new archives with the same name and then doing a ninja swap of the archive file.

(Update: that worked!)

LukasPrism avatar Jan 31 '24 02:01 LukasPrism