@@ -1588,6 +1588,33 @@ static bool application_index_args_normalize_defaults(yyjson_mut_val *root) {
15881588 return true;
15891589}
15901590
1591+ /* One directory is one root. The auto-index job spells repo_path the way the
1592+ * session policy holds it - the platform's native form, backslashes on
1593+ * Windows - while an explicit index_repository request arrives in the
1594+ * handler's forward-slash spelling. Compared byte-exact the two never matched
1595+ * on Windows, and the request was refused as an options conflict instead of
1596+ * joining the job already running for its root. The policy keeps its
1597+ * spelling: the sensitive-root and allowed-root containment checks match it
1598+ * byte-exact against HOME and the granted roots, and respelling it there
1599+ * admitted $HOME. So the fold happens here, on this comparison's private copy,
1600+ * and nothing the daemon stores changes. */
1601+ static bool application_index_args_fold_repo_path (yyjson_mut_doc * document ) {
1602+ yyjson_mut_val * root = yyjson_mut_doc_get_root (document );
1603+ yyjson_mut_val * repo_path = yyjson_mut_obj_get (root , "repo_path" );
1604+ if (!repo_path || !yyjson_mut_is_str (repo_path )) {
1605+ return true;
1606+ }
1607+ char * folded = strdup (yyjson_mut_get_str (repo_path ));
1608+ if (!folded ) {
1609+ return false;
1610+ }
1611+ cbm_normalize_path_sep (folded );
1612+ yyjson_mut_val * key = yyjson_mut_str (document , "repo_path" );
1613+ yyjson_mut_val * value = yyjson_mut_strcpy (document , folded );
1614+ free (folded );
1615+ return key && value && yyjson_mut_obj_replace (root , key , value );
1616+ }
1617+
15911618static bool application_index_args_equal (const char * left , const char * right ) {
15921619 if (!left || !right ) {
15931620 return false;
@@ -1600,6 +1627,8 @@ static bool application_index_args_equal(const char *left, const char *right) {
16001627 yyjson_mut_val * right_root = right_copy ? yyjson_mut_doc_get_root (right_copy ) : NULL ;
16011628 bool equal = application_index_args_normalize_defaults (left_root ) &&
16021629 application_index_args_normalize_defaults (right_root ) &&
1630+ application_index_args_fold_repo_path (left_copy ) &&
1631+ application_index_args_fold_repo_path (right_copy ) &&
16031632 yyjson_mut_equals (left_root , right_root );
16041633 yyjson_mut_doc_free (left_copy );
16051634 yyjson_mut_doc_free (right_copy );
@@ -1608,6 +1637,10 @@ static bool application_index_args_equal(const char *left, const char *right) {
16081637 return equal ;
16091638}
16101639
1640+ bool cbm_daemon_application_index_args_equal_for_test (const char * left , const char * right ) {
1641+ return application_index_args_equal (left , right );
1642+ }
1643+
16111644/* Caller holds application->mutex. Keeping watcher ownership validation and
16121645 * this admission in the same critical section closes the unwatch race. */
16131646static cbm_daemon_application_job_t * application_job_subscribe_locked (
0 commit comments