Skip to content

Commit e96d5b2

Browse files
committed
fix: #26 facade rebuild
1 parent dc69e15 commit e96d5b2

File tree

2 files changed

+4
-14
lines changed

2 files changed

+4
-14
lines changed

app/Coding.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,8 @@ public function upload(array $uploadToken, string $fileFullPath): bool
8888
config(['filesystems.disks.cos.region' => $uploadToken['Region']]);
8989
config(['filesystems.disks.cos.bucket' => $uploadToken['Bucket']]);
9090

91-
return Storage::disk('cos')->put($uploadToken['StorageKey'], File::get($fileFullPath));
91+
$disk = Storage::build(config('filesystems.disks.cos'));
92+
return $disk->put($uploadToken['StorageKey'], File::get($fileFullPath));
9293
}
9394

9495
public function createWikiByZip(string $token, string $projectName, array $uploadToken, array $data)
@@ -104,7 +105,7 @@ public function createWikiByZip(string $token, string $projectName, array $uploa
104105
'ProjectName' => $projectName,
105106
'ParentIid' => $data['ParentIid'],
106107
'FileName' => $data['FileName'],
107-
'Key' => $data['FileName'],
108+
'Key' => $uploadToken['StorageKey'],
108109
'Time' => $uploadToken['Time'],
109110
'AuthToken' => $uploadToken['AuthToken'],
110111
],

tests/Unit/CodingTest.php

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -119,17 +119,6 @@ public function testCreateMarkdownZip()
119119
$this->assertEquals('attachments/65619/65623.png', $zip->getNameIndex(2));
120120
}
121121

122-
public function testUpload()
123-
{
124-
$file = $this->faker->filePath();
125-
Storage::fake('cos');
126-
127-
$coding = new Coding();
128-
$coding->upload(self::$uploadToken, $file);
129-
130-
Storage::disk('cos')->assertExists(self::$uploadToken['StorageKey']);
131-
}
132-
133122
public function testGetImportJobStatus()
134123
{
135124
$responseBody = file_get_contents($this->dataDir . 'coding/DescribeImportJobStatusResponse.json');
@@ -189,7 +178,7 @@ public function testCreateWikiByZip()
189178
'ProjectName' => $codingProjectUri,
190179
'ParentIid' => $data['ParentIid'],
191180
'FileName' => $data['FileName'],
192-
'Key' => $data['FileName'],
181+
'Key' => self::$uploadToken['StorageKey'],
193182
'Time' => self::$uploadToken['Time'],
194183
'AuthToken' => self::$uploadToken['AuthToken'],
195184
],

0 commit comments

Comments
 (0)