Skip to content

Commit

Permalink
[FIX] Use safely formatted Media URLs
Browse files Browse the repository at this point in the history
Co-Authored-By: Vincent van Hoven <11269255+vincentvanhoven@users.noreply.github.com>
  • Loading branch information
Vincent van Hoven and vincentvanhoven committed Jul 25, 2024
1 parent b7ad3a8 commit e293a34
Show file tree
Hide file tree
Showing 9 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion src/Jobs/Feeds/AdmarktFeed.php
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ protected function productToFeedRow(Product $product)

$i = 1;
while ($i < 24) {
$fields['image'.$i] = (isset($product->images[$i - 1])) ? $product->images[$i - 1]->getPublicUrl() : '';
$fields['image'.$i] = (isset($product->images[$i - 1])) ? $product->images[$i - 1]->getPublicUrl(true) : '';
$i++;
}

Expand Down
2 changes: 1 addition & 1 deletion src/Jobs/Feeds/BeslistFeed.php
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ protected function productToFeedRow(Product $product)
->first();

if ($image) {
$fields['image_link'] = $image->getPublicUrl();
$fields['image_link'] = $image->getPublicUrl(true);
}

//TODO don't hard code id for beslist
Expand Down
2 changes: 1 addition & 1 deletion src/Jobs/Feeds/BolFeed.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ protected function getProductQuery(): Builder
protected function productToFeedRow(Product $product)
{
// fetch images
$images = implode(',', $product->images->map->getPublicUrl()->all());
$images = implode(',', $product->images->map->getPublicUrl(true)->all());

// set bol price
$shippingCost = 0;
Expand Down
2 changes: 1 addition & 1 deletion src/Jobs/Feeds/FacebookFeed.php
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ public function getFacebookFeedImageLinks(Product $product): array
];

if (!empty($eligibleImages)) {
$eligibleImagesSrc = $eligibleImages->map->getPublicUrl();
$eligibleImagesSrc = $eligibleImages->map->getPublicUrl(true);

$imageArray['mainImage'] = $eligibleImagesSrc->shift();

Expand Down
2 changes: 1 addition & 1 deletion src/Jobs/Feeds/Feed.php
Original file line number Diff line number Diff line change
Expand Up @@ -376,7 +376,7 @@ protected function getImageLink(Product $product): ?string
{
$image = $product->images()->first();

return optional($image)->getPublicUrl();
return optional($image)->getPublicUrl(true);
}

protected function getCategories(Product $product): string
Expand Down
2 changes: 1 addition & 1 deletion src/Jobs/Feeds/GoogleFeed.php
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ protected function productToFeedRow(Product $product)
->first();

if (! is_null($image)) {
$fields['image_link'] = $image->getPublicUrl();
$fields['image_link'] = $image->getPublicUrl(true);
}

return $fields;
Expand Down
2 changes: 1 addition & 1 deletion src/Jobs/Feeds/NetrivalsFeed.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ protected function productToFeedRow(Product $product)
'product_id' => $product->id,
'title' => $product->name,
'price' => $this->priceFormatter->getFormattedPrice($product),
'image_url' => optional($product->images()->first())->getPublicUrl(),
'image_url' => optional($product->images()->first())->getPublicUrl(true),
'product_type' => ($product->group_id !== null) ? $product->group->name : '(not set)',
'brand' => optional($product->brand)->name,
'ean' => $product->ean,
Expand Down
2 changes: 1 addition & 1 deletion src/Jobs/Feeds/ShoprFeed.php
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ protected function productToFeedRow(Product $product)
'category' => $product->categories->first()->name,
'delivery_time' => $product->shippingTime->name ?? $this->getDelivery($product),
'additional_costs' => $shippingCost,
'image_1' => $product->images->first()->getPublicUrl(),
'image_1' => $product->images->first()->getPublicUrl(true),
'group_id' => '', //gets filled later
'gtin' => $product->ean,
'brand' => '', //gets filled later
Expand Down
2 changes: 1 addition & 1 deletion src/Jobs/Feeds/TradeTrackerFeed.php
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ protected function productToFeedRow(Product $product)
$fields['brand'] = $product->brand->name;
}

$images = $product->images->take(5)->map->getPublicUrl()->all();
$images = $product->images->take(5)->map->getPublicUrl(true)->all();

foreach ($images as $key => $image) {
$fields['imageURL-'.($key + 1)] = $image;
Expand Down

0 comments on commit e293a34

Please sign in to comment.