File tree Expand file tree Collapse file tree 3 files changed +17
-7
lines changed Expand file tree Collapse file tree 3 files changed +17
-7
lines changed Original file line number Diff line number Diff line change @@ -13,8 +13,12 @@ class AssetsFs extends Fs
1313
1414 public function init (): void
1515 {
16- $ this ->useLocalFs = !Module::getInstance ()->getConfig ()->useAssetCdn ;
1716 parent ::init ();
17+ $ this ->useLocalFs = !Module::getInstance ()->getConfig ()->useAssetCdn ;
18+
19+ if ($ this ->useLocalFs ) {
20+ $ this ->baseUrl = $ this ->getLocalFs ()->getRootUrl ();
21+ }
1822 }
1923
2024 /**
Original file line number Diff line number Diff line change 22
33namespace craft \cloud \fs ;
44
5+ use craft \cloud \Helper ;
56use craft \cloud \Module ;
67use League \Uri \Contracts \SegmentedPathInterface ;
78
89class BuildArtifactsFs extends BuildsFs
910{
1011 public bool $ hasUrls = true ;
12+ public ?string $ localFsPath = '@webroot ' ;
13+ public ?string $ localFsUrl = '@web ' ;
1114
1215 public function init (): void
1316 {
14- $ this ->baseUrl = Module::getInstance ()->getConfig ()->artifactBaseUrl ;
1517 parent ::init ();
18+ $ this ->useLocalFs = !Helper::isCraftCloud ();
19+ $ this ->baseUrl = Module::getInstance ()->getConfig ()->artifactBaseUrl ;
20+
21+ if ($ this ->useLocalFs && !$ this ->baseUrl ) {
22+ $ this ->baseUrl = $ this ->getLocalFs ()->getRootUrl ();
23+ }
1624 }
1725
1826 public function createBucketPrefix (): SegmentedPathInterface
Original file line number Diff line number Diff line change @@ -70,7 +70,7 @@ protected function getLocalFs(): Local
7070 $ this ->localFs = $ this ->localFs ?? Craft::createObject ([
7171 'class ' => Local::class,
7272 'hasUrls ' => $ this ->hasUrls ,
73- 'path ' => $ path ->toString (),
73+ 'path ' => $ path? ->toString(),
7474 'url ' => $ this ->localFsUrl ,
7575 ]);
7676
@@ -91,10 +91,8 @@ public function getRootUrl(): ?string
9191
9292 public function createUrl (string $ path = '' ): UriInterface
9393 {
94- $ baseUrl = $ this ->useLocalFs ? $ this ->getLocalFs ()->getRootUrl () : $ this ->baseUrl ;
95-
96- if ($ baseUrl ) {
97- return Modifier::from ($ baseUrl )
94+ if ($ this ->baseUrl ) {
95+ return Modifier::from ($ this ->baseUrl )
9896 ->appendSegment ($ this ->createPath ($ path ))
9997 ->getUri ();
10098 }
You can’t perform that action at this time.
0 commit comments