Skip to content

Commit e8c9e86

Browse files
committed
Merge branch 'master' into fix-wrong-hydefront-version-constant
2 parents 1de8f34 + 6ba776d commit e8c9e86

File tree

2 files changed

+14
-7
lines changed

2 files changed

+14
-7
lines changed

RELEASE_NOTES.md

+1
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ This release is the first since the official release of HydePHP 1.0.0. It contai
2323
- Fixed https://github.com/hydephp/develop/issues/1313 in https://github.com/hydephp/develop/commit/134776a1e4af395dab5c15d611fc64c9ebce8596
2424
- Fixed https://github.com/hydephp/develop/issues/1316 in https://github.com/hydephp/develop/pull/1317
2525
- Fixed https://github.com/hydephp/develop/issues/1318 in https://github.com/hydephp/develop/pull/1319
26+
- Fixed https://github.com/hydephp/develop/issues/1320 in https://github.com/hydephp/develop/pull/1321
2627
- Fixed https://github.com/hydephp/develop/issues/1322 in https://github.com/hydephp/develop/issues/1323
2728
- Added missing function imports in https://github.com/hydephp/develop/pull/1309
2829

packages/framework/src/Framework/Features/Blogging/Models/FeaturedImage.php

+13-7
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
use Hyde\Framework\Exceptions\FileNotFoundException;
1414
use Hyde\Markdown\Contracts\FrontMatter\SubSchemas\FeaturedImageSchema;
1515

16+
use function in_array;
1617
use function array_key_exists;
1718
use function array_flip;
1819
use function file_exists;
@@ -224,15 +225,20 @@ protected function getContentLengthForLocalImage(): int
224225

225226
protected function getContentLengthForRemoteImage(): int
226227
{
227-
$headers = Http::withHeaders([
228-
'User-Agent' => Config::getString('hyde.http_user_agent', 'RSS Request Client'),
229-
])->head($this->getSource())->headers();
228+
// TODO: We may want to globalize this check in the config, but for now,
229+
// we just check the server arguments and skip remote requests if
230+
// the --no-api flag is present (in the build command call)
231+
if (! (isset($_SERVER['argv']) && in_array('--no-api', $_SERVER['argv'], true))) {
232+
$headers = Http::withHeaders([
233+
'User-Agent' => Config::getString('hyde.http_user_agent', 'RSS Request Client'),
234+
])->head($this->getSource())->headers();
230235

231-
if (array_key_exists('Content-Length', $headers)) {
232-
return (int) key(array_flip($headers['Content-Length']));
233-
}
236+
if (array_key_exists('Content-Length', $headers)) {
237+
return (int) key(array_flip($headers['Content-Length']));
238+
}
234239

235-
BuildWarnings::report('The image "'.$this->getSource().'" has a content length of zero.');
240+
BuildWarnings::report('The image "'.$this->getSource().'" has a content length of zero.');
241+
}
236242

237243
return 0;
238244
}

0 commit comments

Comments
 (0)