@@ -13,6 +13,7 @@ import {
1313 processContentTemplate ,
1414 extractNumberFromFilename
1515} from "./util/templateUtils" ;
16+ import { getEffectiveRepoSettings } from "./util/settingsUtils" ;
1617
1718export class FileManager {
1819 constructor (
@@ -50,12 +51,15 @@ export class FileManager {
5051 allIssuesIncludingRecentlyClosed : any [ ] ,
5152 _currentIssueNumbers : Set < string > ,
5253 ) : Promise < void > {
53- const [ owner , repoName ] = repo . repository . split ( "/" ) ;
54+ // Apply global defaults to repository settings
55+ const effectiveRepo = getEffectiveRepoSettings ( repo , this . settings . globalDefaults ) ;
56+
57+ const [ owner , repoName ] = effectiveRepo . repository . split ( "/" ) ;
5458 if ( ! owner || ! repoName ) return ;
5559 const repoCleaned = repoName . replace ( / \/ / g, "-" ) ;
5660 const ownerCleaned = owner . replace ( / \/ / g, "-" ) ;
5761 await this . cleanupDeletedIssues (
58- repo ,
62+ effectiveRepo ,
5963 ownerCleaned ,
6064 repoCleaned ,
6165 allIssuesIncludingRecentlyClosed ,
@@ -64,7 +68,7 @@ export class FileManager {
6468 // Create or update issue files for open issues
6569 for ( const issue of openIssues ) {
6670 await this . createOrUpdateIssueFile (
67- repo ,
71+ effectiveRepo ,
6872 ownerCleaned ,
6973 repoCleaned ,
7074 issue ,
@@ -81,22 +85,25 @@ export class FileManager {
8185 allPullRequestsIncludingRecentlyClosed : any [ ] ,
8286 _currentPRNumbers : Set < string > ,
8387 ) : Promise < void > {
84- const [ owner , repoName ] = repo . repository . split ( "/" ) ;
88+ // Apply global defaults to repository settings
89+ const effectiveRepo = getEffectiveRepoSettings ( repo , this . settings . globalDefaults ) ;
90+
91+ const [ owner , repoName ] = effectiveRepo . repository . split ( "/" ) ;
8592 if ( ! owner || ! repoName ) return ;
8693
8794 const repoCleaned = repoName . replace ( / \/ / g, "-" ) ;
8895 const ownerCleaned = owner . replace ( / \/ / g, "-" ) ;
8996
9097 await this . cleanupDeletedPullRequests (
91- repo ,
98+ effectiveRepo ,
9299 ownerCleaned ,
93100 repoCleaned ,
94101 allPullRequestsIncludingRecentlyClosed ,
95102 ) ;
96103
97104 for ( const pr of openPullRequests ) {
98105 await this . createOrUpdatePullRequestFile (
99- repo ,
106+ effectiveRepo ,
100107 ownerCleaned ,
101108 repoCleaned ,
102109 pr ,
@@ -565,6 +572,12 @@ export class FileManager {
565572 }
566573
567574 private async ensureFolderExists ( path : string ) : Promise < void > {
575+ // Guard against undefined or empty paths
576+ if ( ! path || path . trim ( ) === "" ) {
577+ this . noticeManager . error ( "Cannot create folder: path is empty or undefined" ) ;
578+ return ;
579+ }
580+
568581 const folder = this . app . vault . getAbstractFileByPath ( path ) ;
569582 if ( ! folder ) {
570583 try {
0 commit comments