648648 <span class =" user-tag" >Query File: <br /></span >
649649 <button
650650 @click ="
651- fetchQuery(query.hash, selectedPodUrl + 'querycache/' )
651+ fetchQuery(query.hash, getQueryCacheContainerUrl() )
652652 "
653653 class =" drop-down"
654654 >
679679 @click ="
680680 fetchResults(
681681 query.hash,
682- selectedPodUrl + 'querycache/' ,
682+ getQueryCacheContainerUrl() ,
683683 )
684684 "
685685 class =" drop-down"
902902 class =" results-container"
903903 v-if ="
904904 loading ||
905+ queryError != null ||
905906 (currentQuery.output != null &&
906907 typeof currentQuery.output !== 'string')
907908 "
10201021 class =" null-results"
10211022 v-show ="
10221023 !loading &&
1024+ queryError == null &&
10231025 resultsForYasr != null &&
10241026 resultsForYasr.results.bindings.length === 0
10251027 "
@@ -2199,7 +2201,7 @@ export default {
21992201 this .renameFeedback = null ;
22002202 try {
22012203 const renamed = await renameCachedQueryEntry (
2202- ` ${ this .selectedPodUrl }querycache/queries.ttl ` ,
2204+ this .getQueryCacheIndexUrl () ,
22032205 query .hash ,
22042206 trimmedLabel ,
22052207 );
@@ -3292,8 +3294,8 @@ export default {
32923294
32933295 // Methods for the deletion of a query cache entry
32943296 async confirmAndDelete(queryHash : string ) {
3295- const queryFile = ` ${this .selectedPodUrl }querycache/ ${queryHash }.rq ` ;
3296- const resultsFile = ` ${this .selectedPodUrl }querycache/ ${queryHash }.json ` ;
3297+ const queryFile = ` ${this .getQueryCacheContainerUrl ()} ${queryHash }.rq ` ;
3298+ const resultsFile = ` ${this .getQueryCacheContainerUrl ()} ${queryHash }.json ` ;
32973299
32983300 const message =
32993301 " Are you sure you want to delete this cache entry? This action cannot be undone." ;
@@ -3336,7 +3338,7 @@ export default {
33363338 async removeCachedRecord(queryHash : string ) {
33373339 // remove the record from queries.ttl
33383340 const queriesttlUpdate = await deleteThing (
3339- this .selectedPodUrl + " querycache/queries.ttl " ,
3341+ this .getQueryCacheIndexUrl () ,
33403342 queryHash ,
33413343 );
33423344 return queriesttlUpdate ;
@@ -3348,16 +3350,37 @@ export default {
33483350 this .currentView = " previousQueries" ;
33493351 await this .loadCache ();
33503352 },
3353+ /**
3354+ * Normalizes the selected pod URL into a predictable querycache container.
3355+ * This prevents subtle path bugs when the selected pod omits trailing slash.
3356+ */
3357+ getQueryCacheContainerUrl() {
3358+ const podUrl = this .selectedPodUrl .trim ();
3359+ if (podUrl === " " ) {
3360+ return " " ;
3361+ }
3362+ const podBase = podUrl .endsWith (" /" ) ? podUrl : ` ${podUrl }/ ` ;
3363+ return ` ${podBase }querycache/ ` ;
3364+ },
3365+ /**
3366+ * Resolves the canonical path of the cache index file.
3367+ */
3368+ getQueryCacheIndexUrl() {
3369+ return ` ${this .getQueryCacheContainerUrl ()}queries.ttl ` ;
3370+ },
33513371 async loadCache() {
3372+ if (! this .loggedIn || this .selectedPodUrl .trim () === " " ) {
3373+ this .queriesCacheExists = false ;
3374+ this .cachedQueries = [];
3375+ return ;
3376+ }
3377+
33523378 this .clearRetrievedResults ();
3353- this .queriesCacheExists = await getStoredTtl (
3354- this .selectedPodUrl + " querycache/queries.ttl" ,
3355- );
3379+ const cacheIndexUrl = this .getQueryCacheIndexUrl ();
3380+ this .queriesCacheExists = await getStoredTtl (cacheIndexUrl );
33563381 if (this .queriesCacheExists ) {
33573382 try {
3358- this .cachedQueries = await getCachedQueries (
3359- this .selectedPodUrl + " querycache/queries.ttl" ,
3360- );
3383+ this .cachedQueries = await getCachedQueries (cacheIndexUrl );
33613384 } catch (err ) {
33623385 console .log (" Error fetching queries:" , err );
33633386 }
@@ -3443,7 +3466,7 @@ export default {
34433466 * @param path the URL of the resource or container for which access rights are to be displayed
34443467 */
34453468 async getSpecificCacheAclData() {
3446- const cacheUrl = this .selectedPodUrl + " querycache/ " ;
3469+ const cacheUrl = this .getQueryCacheContainerUrl () ;
34473470 this .hasAcl = await fetchPermissionsData (cacheUrl ); // value is either .acl obj OR null (if .acl does not exist)
34483471 if (this .hasAcl !== null ) {
34493472 this .hasAccess = await fetchAclAgents (cacheUrl );
@@ -3461,7 +3484,7 @@ export default {
34613484 * @param path the URL of the resource or container for which access rights are to be displayed
34623485 */
34633486 async getSpecificQueryAclData(queryHash : string ) {
3464- const queryUrl = this .selectedPodUrl + " querycache/ " + queryHash ;
3487+ const queryUrl = ` ${ this .getQueryCacheContainerUrl ()}${ queryHash } ` ;
34653488 this .hasAcl = await fetchPermissionsData (queryUrl ); // value is either .acl obj OR null (if .acl does not exist)
34663489 if (this .hasAcl !== null ) {
34673490 this .hasAccess = await fetchAclAgents (queryUrl );
@@ -3479,7 +3502,7 @@ export default {
34793502 * @param path the URL of the resource or container for which an .acl is to be made
34803503 */
34813504 async makeNewAcl() {
3482- const cacheUrl = this .selectedPodUrl + " querycache/ " ;
3505+ const cacheUrl = this .getQueryCacheContainerUrl () ;
34833506 try {
34843507 await generateAcl (cacheUrl , this .webId );
34853508 await this .getSpecificCacheAclData ();
0 commit comments