mirror of
https://github.com/pixelfed/pixelfed.git
synced 2024-11-22 14:31:26 +00:00
Update ImportPostController, fix IG bug with missing spaces between hashtags
This commit is contained in:
parent
5a2d7e3eca
commit
9c24157ab3
1 changed files with 13 additions and 2 deletions
|
@ -83,6 +83,17 @@ class ImportPostController extends Controller
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function formatHashtags($val = false)
|
||||||
|
{
|
||||||
|
if(!$val || !strlen($val)) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
$groupedHashtagRegex = '/#\w+(?=#)/';
|
||||||
|
|
||||||
|
return preg_replace($groupedHashtagRegex, '$0 ', $val);
|
||||||
|
}
|
||||||
|
|
||||||
public function store(Request $request)
|
public function store(Request $request)
|
||||||
{
|
{
|
||||||
abort_unless(config('import.instagram.enabled'), 404);
|
abort_unless(config('import.instagram.enabled'), 404);
|
||||||
|
@ -128,11 +139,11 @@ class ImportPostController extends Controller
|
||||||
$ip->media = $c->map(function($m) {
|
$ip->media = $c->map(function($m) {
|
||||||
return [
|
return [
|
||||||
'uri' => $m['uri'],
|
'uri' => $m['uri'],
|
||||||
'title' => $m['title'],
|
'title' => $this->formatHashtags($m['title']),
|
||||||
'creation_timestamp' => $m['creation_timestamp']
|
'creation_timestamp' => $m['creation_timestamp']
|
||||||
];
|
];
|
||||||
})->toArray();
|
})->toArray();
|
||||||
$ip->caption = $c->count() > 1 ? $file['title'] : $ip->media[0]['title'];
|
$ip->caption = $c->count() > 1 ? $this->formatHashtags($file['title']) : $this->formatHashtags($ip->media[0]['title']);
|
||||||
$ip->filename = last(explode('/', $ip->media[0]['uri']));
|
$ip->filename = last(explode('/', $ip->media[0]['uri']));
|
||||||
$ip->metadata = $c->map(function($m) {
|
$ip->metadata = $c->map(function($m) {
|
||||||
return [
|
return [
|
||||||
|
|
Loading…
Reference in a new issue