Problem with passing URL parameters into a wiki stored on Sharepoint/WebDAV

Hello,

I have been experimenting with passing parameters of the form:
https://tiddlywiki.com/?some=parameters&someother=parameter2
and using those parameters to set some defaults using a startup tiddler that parses $:/info/url/search.

It likely works fine normally except that when I try to save the Tiddlywiki back to Sharepoint, I get a 400 error. I suspect that it is a problem with the save command sent back to the server containing the extra parameters not matching the filename opened but I don’t know the intricacies of the protocol. Is that the expected WebDAV behaviour or is that a bug?

To work around it, I tried to reset the URL using the tm-home message before saving but, while it clears the # permalink additions, it does not clear the ? and parameters. Is tm-home supposed to clear everything? Is there a different tm to use? If not, could there be?

Thanks,
/Mike

I have sort of figured out a solution. Using my cargo-cult knowledge of JavaScript and some AI search results, I have inserted the following into the tm-home message listener in $:/core/modules/startup/story.js in order to overload it with the functionality that I wanted:

$tw.rootWidget.addEventListener("tm-home",function(event) {

...

let currentURL window.location.href;
let basePath currentURL.split("?")[0];
let newURL= basePath;
window.history.replaceState(null, document.title, newURL);

...
});

It works by adding tm-home message into to PostRender to truncate the “search” part of the URL after parsing it.

I don’t really want to carry modifications to the core js files in my wiki for obvious maintainability issues. Can I ask someone with more JavaScript expertise to put this in another tm-truncate message listener that will be loaded separately as a plug-in? Or at least point me to some example I can follow.

Thanks,
/Mike

Nevermind. Using some other examples I was able to work out the critical bits to making a message listener js tiddler, $:/.mw/modules/startup/tm-clear-url-search.js , to listen for the tm-clear-url-search message and allow my url parameter passing to work on Sharepoint servers:

/*\
title: $:/.mw/modules/startup/tm-clear-url-search.js
type: application/javascript
module-type: startup
created: 20250414150000000
creator: Michael Wiktowy

Message listener to clear the "search" part of the location in the browser. This is needed functionality to remove URL path after the ? since this interferes with resaving TiddlyWikis opened from MS Sharepoint.

\*/
(function(){

/*jslint node: true, browser: true */
/*global $tw: false */
"use strict";

// Export name and synchronous status
exports.name = "tm-clear-url-search-listener-on-startup";
exports.platforms = ["browser"];
exports.after = ["startup"];
exports.synchronous = true;

exports.startup = function() {

		// Listen for the tm-clear-url-search message
		$tw.rootWidget.addEventListener("tm-clear-url-search",function(event) {
           let currentURL = window.location.href;
           let basePath = currentURL.split("?")[0];
           let newURL = basePath;
                window.history.replaceState(null, document.title, newURL);
		});
     }
})();

So no core tiddlers need modification now and I can send a message to change https://somedomain.com/?some=parameter to https://somedomain.com/ before saving so it doesn’t break saving on Sharepoint.

Hope this helps someone.

/Mike