[GH-ISSUE #39] Importing artists with a & in their name #30

Closed
opened 2026-02-26 02:31:51 +03:00 by kerem · 20 comments
Owner

Originally created by @whachoe on GitHub (Dec 14, 2015).
Original GitHub issue: https://github.com/koel/koel/issues/39

Hi,

When trying to import an album of an artist with '&' in their name (ex: Djihan & Kamien), i get a unique constraint-error from the Artist-model.
I can fix it by changing the following method:

public function setNameAttribute($value)
    {
        $this->attributes['name'] = html_entity_decode($value);
    }

to this:

public function setNameAttribute($value)
    {
        $this->attributes['name'] = $value;
    }

I'm not sure if i should send a PR for this, since you kind of mentioned the html_entity_decode is necessary in some cases. And seems it's only in some rare cases. Might have something to do with a weirdly formatted id3-tag. I'll try to find the file that caused the mayhem and update my report afterwards..

Originally created by @whachoe on GitHub (Dec 14, 2015). Original GitHub issue: https://github.com/koel/koel/issues/39 Hi, When trying to import an album of an artist with '&' in their name (ex: Djihan & Kamien), i get a unique constraint-error from the Artist-model. I can fix it by changing the following method: ``` php public function setNameAttribute($value) { $this->attributes['name'] = html_entity_decode($value); } ``` to this: ``` php public function setNameAttribute($value) { $this->attributes['name'] = $value; } ``` I'm not sure if i should send a PR for this, since you kind of mentioned the html_entity_decode is necessary in some cases. And seems it's only in some rare cases. Might have something to do with a weirdly formatted id3-tag. I'll try to find the file that caused the mayhem and update my report afterwards..
kerem 2026-02-26 02:31:51 +03:00
Author
Owner

@juliusvdijk commented on GitHub (Dec 15, 2015):

Isn't there a better way to solve this?

In the comment he states that the name stored in the ID3 tags might be html entity encoded so I imagine that this fix breaks more things than it fixes.

<!-- gh-comment-id:164801159 --> @juliusvdijk commented on GitHub (Dec 15, 2015): Isn't there a better way to solve this? In the comment he states that the name stored in the ID3 tags might be html entity encoded so I imagine that this fix breaks more things than it fixes.
Author
Owner

@phanan commented on GitHub (Dec 15, 2015):

I'll be thinking about this. A quick fix could be just replace & with &amp;, but that's not optimal.

<!-- gh-comment-id:164813552 --> @phanan commented on GitHub (Dec 15, 2015): I'll be thinking about this. A quick fix could be just replace `&` with `&amp;`, but that's not optimal.
Author
Owner

@reeslo commented on GitHub (Dec 16, 2015):

just to say, for me the error as occurred for the first scan. If you want more info I can investigate for tell you the filename/tags

<!-- gh-comment-id:165011666 --> @reeslo commented on GitHub (Dec 16, 2015): just to say, for me the error as occurred for the first scan. If you want more info I can investigate for tell you the filename/tags
Author
Owner

@phanan commented on GitHub (Dec 17, 2015):

@whachoe @Reeslo What are you guys' table encodings?

<!-- gh-comment-id:165357932 --> @phanan commented on GitHub (Dec 17, 2015): @whachoe @Reeslo What are you guys' table encodings?
Author
Owner

@whachoe commented on GitHub (Dec 17, 2015):

CHARSET=utf8 COLLATE=utf8_unicode_ci
Engine: InnoDB
mysql --version: mysql Ver 14.14 Distrib 5.5.46, for debian-linux-gnu (x86_64) using readline 6.3

<!-- gh-comment-id:165492606 --> @whachoe commented on GitHub (Dec 17, 2015): CHARSET=utf8 COLLATE=utf8_unicode_ci Engine: InnoDB mysql --version: mysql Ver 14.14 Distrib 5.5.46, for debian-linux-gnu (x86_64) using readline 6.3
Author
Owner

@reeslo commented on GitHub (Dec 17, 2015):

utf8_unicode_ci
InnoDB too
mysql Ver 15.1 Distrib 5.5.46-MariaDB, for debian-linux-gnu (x86_64) using readline 5.2

the default schema collation is utf8mb4_general_ci / characterset utf8mb4
but I think this has no effect :
koel

<!-- gh-comment-id:165538592 --> @reeslo commented on GitHub (Dec 17, 2015): utf8_unicode_ci InnoDB too mysql Ver 15.1 Distrib 5.5.46-MariaDB, for debian-linux-gnu (x86_64) using readline 5.2 the default schema collation is utf8mb4_general_ci / characterset utf8mb4 but I think this has no effect : ![koel](https://cloud.githubusercontent.com/assets/2724844/11878155/4557219e-a4f4-11e5-8c58-6b1d5d8f51bd.png)
Author
Owner

@phanan commented on GitHub (Dec 18, 2015):

I pushed an attempt to fix this. Let me know it it works.

On Fri, Dec 18, 2015 at 2:26 AM, Reeslo notifications@github.com wrote:

utf8_unicode_ci
InnoDB too
mysql Ver 15.1 Distrib 5.5.46-MariaDB, for debian-linux-gnu (x86_64) using
readline 5.2

the default schema collation is utf8mb4_general_ci / characterset utf8mb4
but I think this has no effect


Reply to this email directly or view it on GitHub
https://github.com/phanan/koel/issues/39#issuecomment-165538592.

<!-- gh-comment-id:165643889 --> @phanan commented on GitHub (Dec 18, 2015): I pushed an attempt to fix this. Let me know it it works. On Fri, Dec 18, 2015 at 2:26 AM, Reeslo notifications@github.com wrote: > utf8_unicode_ci > InnoDB too > mysql Ver 15.1 Distrib 5.5.46-MariaDB, for debian-linux-gnu (x86_64) using > readline 5.2 > > the default schema collation is utf8mb4_general_ci / characterset utf8mb4 > but I think this has no effect > > — > Reply to this email directly or view it on GitHub > https://github.com/phanan/koel/issues/39#issuecomment-165538592.
Author
Owner

@reeslo commented on GitHub (Dec 18, 2015):

Ok, I check that today

<!-- gh-comment-id:165681440 --> @reeslo commented on GitHub (Dec 18, 2015): Ok, I check that today
Author
Owner

@whachoe commented on GitHub (Dec 18, 2015):

Just tested here... That seems to do the trick. Started with an empty DB and it's filling up nicely.

<!-- gh-comment-id:165696615 --> @whachoe commented on GitHub (Dec 18, 2015): Just tested here... That seems to do the trick. Started with an empty DB and it's filling up nicely.
Author
Owner

@phanan commented on GitHub (Dec 19, 2015):

Great! I'm closing this issue then.

<!-- gh-comment-id:165935490 --> @phanan commented on GitHub (Dec 19, 2015): Great! I'm closing this issue then.
Author
Owner

@reeslo commented on GitHub (Dec 19, 2015):

Import work for me until the end (without clean up database before).
But some error appear
github.com/phanan/koel@a2484362c2/app/Models/Album.php (L71)

Debug log :

[2015-12-18 15:43:45] local.ERROR: exception 'ErrorException' with message 'Undefined offset: 1' in /koel/app/Models/Album.php:71
Stack trace:
#0 /koel/app/Models/Album.php(71): Illuminate\Foundation\Bootstrap\HandleExceptions->handleError(8, 'Undefined offse...', '/ko...', 71, Array)
#1 /koel/app/Services/Media.php(108): App\Models\Album->generateCover(Array)
#2 /koel/app/Services/Media.php(52): App\Services\Media->syncFile(Object(Symfony\Component\Finder\SplFileInfo))
#3 /koel/bootstrap/cache/compiled.php(6022): App\Services\Media->sync()
#4 /koel/app/Http/Controllers/API/SettingController.php(25): Illuminate\Support\Facades\Facade::__callStatic('sync', Array)
#5 /koel/app/Http/Controllers/API/SettingController.php(25): App\Facades\Media::sync()
#6 [internal function]: App\Http\Controllers\API\SettingController->save(Object(App\Http\Requests\API\SettingRequest))
#7 /koel/bootstrap/cache/compiled.php(8866): call_user_func_array(Array, Array)
#8 /koel/bootstrap/cache/compiled.php(8935): Illuminate\Routing\Controller->callAction('save', Array)
#9 /koel/bootstrap/cache/compiled.php(8915): Illuminate\Routing\ControllerDispatcher->call(Object(App\Http\Controllers\API\SettingController), Object(Illuminate\Routing\Route), 'save')
#10 [internal function]: Illuminate\Routing\ControllerDispatcher->Illuminate\Routing\{closure}(Object(Illuminate\Http\Request))
#11 /koel/bootstrap/cache/compiled.php(9585): call_user_func(Object(Closure), Object(Illuminate\Http\Request))
#12 [internal function]: Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))
#13 /koel/bootstrap/cache/compiled.php(9567): call_user_func(Object(Closure), Object(Illuminate\Http\Request))
#14 /koel/bootstrap/cache/compiled.php(8916): Illuminate\Pipeline\Pipeline->then(Object(Closure))
#15 /koel/bootstrap/cache/compiled.php(8901): Illuminate\Routing\ControllerDispatcher->callWithinStack(Object(App\Http\Controllers\API\SettingController), Object(Illuminate\Routing\Route), Object(Illuminate\Http\Request), 'save')
#16 /koel/bootstrap/cache/compiled.php(7855): Illuminate\Routing\ControllerDispatcher->dispatch(Object(Illuminate\Routing\Route), Object(Illuminate\Http\Request), 'App\Http\Contro...', 'save')
#17 /koel/bootstrap/cache/compiled.php(7826): Illuminate\Routing\Route->runWithCustomDispatcher(Object(Illuminate\Http\Request))
#18 /koel/bootstrap/cache/compiled.php(7479): Illuminate\Routing\Route->run(Object(Illuminate\Http\Request))
#19 [internal function]: Illuminate\Routing\Router->Illuminate\Routing\{closure}(Object(Illuminate\Http\Request))
#20 /koel/bootstrap/cache/compiled.php(9585): call_user_func(Object(Closure), Object(Illuminate\Http\Request))
#21 /koel/app/Http/Middleware/Authenticate.php(45): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))
#22 [internal function]: App\Http\Middleware\Authenticate->handle(Object(Illuminate\Http\Request), Object(Closure))
#23 /koel/bootstrap/cache/compiled.php(9577): call_user_func_array(Array, Array)
#24 [internal function]: Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))
#25 /koel/bootstrap/cache/compiled.php(9567): call_user_func(Object(Closure), Object(Illuminate\Http\Request))
#26 /koel/bootstrap/cache/compiled.php(7480): Illuminate\Pipeline\Pipeline->then(Object(Closure))
#27 /koel/bootstrap/cache/compiled.php(7468): Illuminate\Routing\Router->runRouteWithinStack(Object(Illuminate\Routing\Route), Object(Illuminate\Http\Request))
#28 /koel/bootstrap/cache/compiled.php(7453): Illuminate\Routing\Router->dispatchToRoute(Object(Illuminate\Http\Request))
#29 /koel/bootstrap/cache/compiled.php(2302): Illuminate\Routing\Router->dispatch(Object(Illuminate\Http\Request))
#30 [internal function]: Illuminate\Foundation\Http\Kernel->Illuminate\Foundation\Http\{closure}(Object(Illuminate\Http\Request))
#31 /koel/bootstrap/cache/compiled.php(9585): call_user_func(Object(Closure), Object(Illuminate\Http\Request))
#32 /koel/bootstrap/cache/compiled.php(2926): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))
#33 [internal function]: Illuminate\Foundation\Http\Middleware\VerifyCsrfToken->handle(Object(Illuminate\Http\Request), Object(Closure))
#34 /koel/bootstrap/cache/compiled.php(9577): call_user_func_array(Array, Array)
#35 /koel/bootstrap/cache/compiled.php(12949): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))
#36 [internal function]: Illuminate\View\Middleware\ShareErrorsFromSession->handle(Object(Illuminate\Http\Request), Object(Closure))
#37 /koel/bootstrap/cache/compiled.php(9577): call_user_func_array(Array, Array)
#38 /koel/bootstrap/cache/compiled.php(11536): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))
#39 [internal function]: Illuminate\Session\Middleware\StartSession->handle(Object(Illuminate\Http\Request), Object(Closure))
#40 /koel/bootstrap/cache/compiled.php(9577): call_user_func_array(Array, Array)
#41 /koel/bootstrap/cache/compiled.php(12686): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))
#42 [internal function]: Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse->handle(Object(Illuminate\Http\Request), Object(Closure))
#43 /koel/bootstrap/cache/compiled.php(9577): call_user_func_array(Array, Array)
#44 /koel/bootstrap/cache/compiled.php(12623): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))
#45 [internal function]: Illuminate\Cookie\Middleware\EncryptCookies->handle(Object(Illuminate\Http\Request), Object(Closure))
#46 /koel/bootstrap/cache/compiled.php(9577): call_user_func_array(Array, Array)
#47 /koel/bootstrap/cache/compiled.php(2983): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))
#48 [internal function]: Illuminate\Foundation\Http\Middleware\CheckForMaintenanceMode->handle(Object(Illuminate\Http\Request), Object(Closure))
#49 /koel/bootstrap/cache/compiled.php(9577): call_user_func_array(Array, Array)
#50 [internal function]: Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))
#51 /koel/bootstrap/cache/compiled.php(9567): call_user_func(Object(Closure), Object(Illuminate\Http\Request))
#52 /koel/bootstrap/cache/compiled.php(2249): Illuminate\Pipeline\Pipeline->then(Object(Closure))
#53 /koel/bootstrap/cache/compiled.php(2232): Illuminate\Foundation\Http\Kernel->sendRequestThroughRouter(Object(Illuminate\Http\Request))
#54 /koel/index.php(53): Illuminate\Foundation\Http\Kernel->handle(Object(Illuminate\Http\Request))
#55 /koel/server.php(19): require_once('/ko...')
#56 {main}  
<!-- gh-comment-id:165955933 --> @reeslo commented on GitHub (Dec 19, 2015): Import work for me until the end (without clean up database before). But some error appear https://github.com/phanan/koel/blob/a2484362c257e1b14d75f8814bd554a4a47f672b/app/Models/Album.php#L71 Debug log : ``` [2015-12-18 15:43:45] local.ERROR: exception 'ErrorException' with message 'Undefined offset: 1' in /koel/app/Models/Album.php:71 Stack trace: #0 /koel/app/Models/Album.php(71): Illuminate\Foundation\Bootstrap\HandleExceptions->handleError(8, 'Undefined offse...', '/ko...', 71, Array) #1 /koel/app/Services/Media.php(108): App\Models\Album->generateCover(Array) #2 /koel/app/Services/Media.php(52): App\Services\Media->syncFile(Object(Symfony\Component\Finder\SplFileInfo)) #3 /koel/bootstrap/cache/compiled.php(6022): App\Services\Media->sync() #4 /koel/app/Http/Controllers/API/SettingController.php(25): Illuminate\Support\Facades\Facade::__callStatic('sync', Array) #5 /koel/app/Http/Controllers/API/SettingController.php(25): App\Facades\Media::sync() #6 [internal function]: App\Http\Controllers\API\SettingController->save(Object(App\Http\Requests\API\SettingRequest)) #7 /koel/bootstrap/cache/compiled.php(8866): call_user_func_array(Array, Array) #8 /koel/bootstrap/cache/compiled.php(8935): Illuminate\Routing\Controller->callAction('save', Array) #9 /koel/bootstrap/cache/compiled.php(8915): Illuminate\Routing\ControllerDispatcher->call(Object(App\Http\Controllers\API\SettingController), Object(Illuminate\Routing\Route), 'save') #10 [internal function]: Illuminate\Routing\ControllerDispatcher->Illuminate\Routing\{closure}(Object(Illuminate\Http\Request)) #11 /koel/bootstrap/cache/compiled.php(9585): call_user_func(Object(Closure), Object(Illuminate\Http\Request)) #12 [internal function]: Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request)) #13 /koel/bootstrap/cache/compiled.php(9567): call_user_func(Object(Closure), Object(Illuminate\Http\Request)) #14 /koel/bootstrap/cache/compiled.php(8916): Illuminate\Pipeline\Pipeline->then(Object(Closure)) #15 /koel/bootstrap/cache/compiled.php(8901): Illuminate\Routing\ControllerDispatcher->callWithinStack(Object(App\Http\Controllers\API\SettingController), Object(Illuminate\Routing\Route), Object(Illuminate\Http\Request), 'save') #16 /koel/bootstrap/cache/compiled.php(7855): Illuminate\Routing\ControllerDispatcher->dispatch(Object(Illuminate\Routing\Route), Object(Illuminate\Http\Request), 'App\Http\Contro...', 'save') #17 /koel/bootstrap/cache/compiled.php(7826): Illuminate\Routing\Route->runWithCustomDispatcher(Object(Illuminate\Http\Request)) #18 /koel/bootstrap/cache/compiled.php(7479): Illuminate\Routing\Route->run(Object(Illuminate\Http\Request)) #19 [internal function]: Illuminate\Routing\Router->Illuminate\Routing\{closure}(Object(Illuminate\Http\Request)) #20 /koel/bootstrap/cache/compiled.php(9585): call_user_func(Object(Closure), Object(Illuminate\Http\Request)) #21 /koel/app/Http/Middleware/Authenticate.php(45): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request)) #22 [internal function]: App\Http\Middleware\Authenticate->handle(Object(Illuminate\Http\Request), Object(Closure)) #23 /koel/bootstrap/cache/compiled.php(9577): call_user_func_array(Array, Array) #24 [internal function]: Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request)) #25 /koel/bootstrap/cache/compiled.php(9567): call_user_func(Object(Closure), Object(Illuminate\Http\Request)) #26 /koel/bootstrap/cache/compiled.php(7480): Illuminate\Pipeline\Pipeline->then(Object(Closure)) #27 /koel/bootstrap/cache/compiled.php(7468): Illuminate\Routing\Router->runRouteWithinStack(Object(Illuminate\Routing\Route), Object(Illuminate\Http\Request)) #28 /koel/bootstrap/cache/compiled.php(7453): Illuminate\Routing\Router->dispatchToRoute(Object(Illuminate\Http\Request)) #29 /koel/bootstrap/cache/compiled.php(2302): Illuminate\Routing\Router->dispatch(Object(Illuminate\Http\Request)) #30 [internal function]: Illuminate\Foundation\Http\Kernel->Illuminate\Foundation\Http\{closure}(Object(Illuminate\Http\Request)) #31 /koel/bootstrap/cache/compiled.php(9585): call_user_func(Object(Closure), Object(Illuminate\Http\Request)) #32 /koel/bootstrap/cache/compiled.php(2926): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request)) #33 [internal function]: Illuminate\Foundation\Http\Middleware\VerifyCsrfToken->handle(Object(Illuminate\Http\Request), Object(Closure)) #34 /koel/bootstrap/cache/compiled.php(9577): call_user_func_array(Array, Array) #35 /koel/bootstrap/cache/compiled.php(12949): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request)) #36 [internal function]: Illuminate\View\Middleware\ShareErrorsFromSession->handle(Object(Illuminate\Http\Request), Object(Closure)) #37 /koel/bootstrap/cache/compiled.php(9577): call_user_func_array(Array, Array) #38 /koel/bootstrap/cache/compiled.php(11536): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request)) #39 [internal function]: Illuminate\Session\Middleware\StartSession->handle(Object(Illuminate\Http\Request), Object(Closure)) #40 /koel/bootstrap/cache/compiled.php(9577): call_user_func_array(Array, Array) #41 /koel/bootstrap/cache/compiled.php(12686): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request)) #42 [internal function]: Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse->handle(Object(Illuminate\Http\Request), Object(Closure)) #43 /koel/bootstrap/cache/compiled.php(9577): call_user_func_array(Array, Array) #44 /koel/bootstrap/cache/compiled.php(12623): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request)) #45 [internal function]: Illuminate\Cookie\Middleware\EncryptCookies->handle(Object(Illuminate\Http\Request), Object(Closure)) #46 /koel/bootstrap/cache/compiled.php(9577): call_user_func_array(Array, Array) #47 /koel/bootstrap/cache/compiled.php(2983): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request)) #48 [internal function]: Illuminate\Foundation\Http\Middleware\CheckForMaintenanceMode->handle(Object(Illuminate\Http\Request), Object(Closure)) #49 /koel/bootstrap/cache/compiled.php(9577): call_user_func_array(Array, Array) #50 [internal function]: Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request)) #51 /koel/bootstrap/cache/compiled.php(9567): call_user_func(Object(Closure), Object(Illuminate\Http\Request)) #52 /koel/bootstrap/cache/compiled.php(2249): Illuminate\Pipeline\Pipeline->then(Object(Closure)) #53 /koel/bootstrap/cache/compiled.php(2232): Illuminate\Foundation\Http\Kernel->sendRequestThroughRouter(Object(Illuminate\Http\Request)) #54 /koel/index.php(53): Illuminate\Foundation\Http\Kernel->handle(Object(Illuminate\Http\Request)) #55 /koel/server.php(19): require_once('/ko...') #56 {main} ```
Author
Owner

@phanan commented on GitHub (Dec 19, 2015):

What's the value of $cover['image_mime']?

On Sat, Dec 19, 2015 at 2:59 PM, Reeslo notifications@github.com wrote:

Import work for me until the end (without clean up database before).
But some error appear

github.com/phanan/koel@a2484362c2/app/Models/Album.php (L71)

Debug log :

[2015-12-18 15:43:45] local.ERROR: exception 'ErrorException' with message 'Undefined offset: 1' in /koel/app/Models/Album.php:71
Stack trace:
#0 /koel/app/Models/Album.php(71): Illuminate\Foundation\Bootstrap\HandleExceptions->handleError(8, 'Undefined offse...', '/ko...', 71, Array)
#1 /koel/app/Services/Media.php(108): App\Models\Album->generateCover(Array)
#2 /koel/app/Services/Media.php(52): App\Services\Media->syncFile(Object(Symfony\Component\Finder\SplFileInfo))
#3 /koel/bootstrap/cache/compiled.php(6022): App\Services\Media->sync()
#4 /koel/app/Http/Controllers/API/SettingController.php(25): Illuminate\Support\Facades\Facade::__callStatic('sync', Array)
#5 /koel/app/Http/Controllers/API/SettingController.php(25): App\Facades\Media::sync()
#6 [internal function]: App\Http\Controllers\API\SettingController->save(Object(App\Http\Requests\API\SettingRequest))
#7 /koel/bootstrap/cache/compiled.php(8866): call_user_func_array(Array, Array)
#8 /koel/bootstrap/cache/compiled.php(8935): Illuminate\Routing\Controller->callAction('save', Array)
#9 /koel/bootstrap/cache/compiled.php(8915): Illuminate\Routing\ControllerDispatcher->call(Object(App\Http\Controllers\API\SettingController), Object(Illuminate\Routing\Route), 'save')
#10 [internal function]: Illuminate\Routing\ControllerDispatcher->Illuminate\Routing{closure}(Object(Illuminate\Http\Request))
#11 /koel/bootstrap/cache/compiled.php(9585): call_user_func(Object(Closure), Object(Illuminate\Http\Request))
#12 [internal function]: Illuminate\Pipeline\Pipeline->Illuminate\Pipeline{closure}(Object(Illuminate\Http\Request))
#13 /koel/bootstrap/cache/compiled.php(9567): call_user_func(Object(Closure), Object(Illuminate\Http\Request))
#14 /koel/bootstrap/cache/compiled.php(8916): Illuminate\Pipeline\Pipeline->then(Object(Closure))
#15 /koel/bootstrap/cache/compiled.php(8901): Illuminate\Routing\ControllerDispatcher->callWithinStack(Object(App\Http\Controllers\API\SettingController), Object(Illuminate\Routing\Route), Object(Illuminate\Http\Request), 'save')
#16 /koel/bootstrap/cache/compiled.php(7855): Illuminate\Routing\ControllerDispatcher->dispatch(Object(Illuminate\Routing\Route), Object(Illuminate\Http\Request), 'App\Http\Contro...', 'save')
#17 /koel/bootstrap/cache/compiled.php(7826): Illuminate\Routing\Route->runWithCustomDispatcher(Object(Illuminate\Http\Request))
#18 /koel/bootstrap/cache/compiled.php(7479): Illuminate\Routing\Route->run(Object(Illuminate\Http\Request))
#19 [internal function]: Illuminate\Routing\Router->Illuminate\Routing{closure}(Object(Illuminate\Http\Request))
#20 /koel/bootstrap/cache/compiled.php(9585): call_user_func(Object(Closure), Object(Illuminate\Http\Request))
#21 /koel/app/Http/Middleware/Authenticate.php(45): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline{closure}(Object(Illuminate\Http\Request))
#22 [internal function]: App\Http\Middleware\Authenticate->handle(Object(Illuminate\Http\Request), Object(Closure))
#23 /koel/bootstrap/cache/compiled.php(9577): call_user_func_array(Array, Array)
#24 [internal function]: Illuminate\Pipeline\Pipeline->Illuminate\Pipeline{closure}(Object(Illuminate\Http\Request))
#25 /koel/bootstrap/cache/compiled.php(9567): call_user_func(Object(Closure), Object(Illuminate\Http\Request))
#26 /koel/bootstrap/cache/compiled.php(7480): Illuminate\Pipeline\Pipeline->then(Object(Closure))
#27 /koel/bootstrap/cache/compiled.php(7468): Illuminate\Routing\Router->runRouteWithinStack(Object(Illuminate\Routing\Route), Object(Illuminate\Http\Request))
#28 /koel/bootstrap/cache/compiled.php(7453): Illuminate\Routing\Router->dispatchToRoute(Object(Illuminate\Http\Request))
#29 /koel/bootstrap/cache/compiled.php(2302): Illuminate\Routing\Router->dispatch(Object(Illuminate\Http\Request))
#30 [internal function]: Illuminate\Foundation\Http\Kernel->Illuminate\Foundation\Http{closure}(Object(Illuminate\Http\Request))
#31 /koel/bootstrap/cache/compiled.php(9585): call_user_func(Object(Closure), Object(Illuminate\Http\Request))
#32 /koel/bootstrap/cache/compiled.php(2926): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline{closure}(Object(Illuminate\Http\Request))
#33 [internal function]: Illuminate\Foundation\Http\Middleware\VerifyCsrfToken->handle(Object(Illuminate\Http\Request), Object(Closure))
#34 /koel/bootstrap/cache/compiled.php(9577): call_user_func_array(Array, Array)
#35 /koel/bootstrap/cache/compiled.php(12949): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline{closure}(Object(Illuminate\Http\Request))
#36 [internal function]: Illuminate\View\Middleware\ShareErrorsFromSession->handle(Object(Illuminate\Http\Request), Object(Closure))
#37 /koel/bootstrap/cache/compiled.php(9577): call_user_func_array(Array, Array)
#38 /koel/bootstrap/cache/compiled.php(11536): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline{closure}(Object(Illuminate\Http\Request))
#39 [internal function]: Illuminate\Session\Middleware\StartSession->handle(Object(Illuminate\Http\Request), Object(Closure))
#40 /koel/bootstrap/cache/compiled.php(9577): call_user_func_array(Array, Array)
#41 /koel/bootstrap/cache/compiled.php(12686): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline{closure}(Object(Illuminate\Http\Request))
#42 [internal function]: Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse->handle(Object(Illuminate\Http\Request), Object(Closure))
#43 /koel/bootstrap/cache/compiled.php(9577): call_user_func_array(Array, Array)
#44 /koel/bootstrap/cache/compiled.php(12623): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline{closure}(Object(Illuminate\Http\Request))
#45 [internal function]: Illuminate\Cookie\Middleware\EncryptCookies->handle(Object(Illuminate\Http\Request), Object(Closure))
#46 /koel/bootstrap/cache/compiled.php(9577): call_user_func_array(Array, Array)
#47 /koel/bootstrap/cache/compiled.php(2983): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline{closure}(Object(Illuminate\Http\Request))
#48 [internal function]: Illuminate\Foundation\Http\Middleware\CheckForMaintenanceMode->handle(Object(Illuminate\Http\Request), Object(Closure))
#49 /koel/bootstrap/cache/compiled.php(9577): call_user_func_array(Array, Array)
#50 [internal function]: Illuminate\Pipeline\Pipeline->Illuminate\Pipeline{closure}(Object(Illuminate\Http\Request))
#51 /koel/bootstrap/cache/compiled.php(9567): call_user_func(Object(Closure), Object(Illuminate\Http\Request))
#52 /koel/bootstrap/cache/compiled.php(2249): Illuminate\Pipeline\Pipeline->then(Object(Closure))
#53 /koel/bootstrap/cache/compiled.php(2232): Illuminate\Foundation\Http\Kernel->sendRequestThroughRouter(Object(Illuminate\Http\Request))
#54 /koel/index.php(53): Illuminate\Foundation\Http\Kernel->handle(Object(Illuminate\Http\Request))
#55 /koel/server.php(19): require_once('/ko...')
#56 {main}


Reply to this email directly or view it on GitHub
https://github.com/phanan/koel/issues/39#issuecomment-165955933.

<!-- gh-comment-id:165959128 --> @phanan commented on GitHub (Dec 19, 2015): What's the value of `$cover['image_mime']`? On Sat, Dec 19, 2015 at 2:59 PM, Reeslo notifications@github.com wrote: > Import work for me until the end (without clean up database before). > But some error appear > > https://github.com/phanan/koel/blob/a2484362c257e1b14d75f8814bd554a4a47f672b/app/Models/Album.php#L71 > > Debug log : > > [2015-12-18 15:43:45] local.ERROR: exception 'ErrorException' with message 'Undefined offset: 1' in /koel/app/Models/Album.php:71 > Stack trace: > #0 /koel/app/Models/Album.php(71): Illuminate\Foundation\Bootstrap\HandleExceptions->handleError(8, 'Undefined offse...', '/ko...', 71, Array) > #1 /koel/app/Services/Media.php(108): App\Models\Album->generateCover(Array) > #2 /koel/app/Services/Media.php(52): App\Services\Media->syncFile(Object(Symfony\Component\Finder\SplFileInfo)) > #3 /koel/bootstrap/cache/compiled.php(6022): App\Services\Media->sync() > #4 /koel/app/Http/Controllers/API/SettingController.php(25): Illuminate\Support\Facades\Facade::__callStatic('sync', Array) > #5 /koel/app/Http/Controllers/API/SettingController.php(25): App\Facades\Media::sync() > #6 [internal function]: App\Http\Controllers\API\SettingController->save(Object(App\Http\Requests\API\SettingRequest)) > #7 /koel/bootstrap/cache/compiled.php(8866): call_user_func_array(Array, Array) > #8 /koel/bootstrap/cache/compiled.php(8935): Illuminate\Routing\Controller->callAction('save', Array) > #9 /koel/bootstrap/cache/compiled.php(8915): Illuminate\Routing\ControllerDispatcher->call(Object(App\Http\Controllers\API\SettingController), Object(Illuminate\Routing\Route), 'save') > #10 [internal function]: Illuminate\Routing\ControllerDispatcher->Illuminate\Routing{closure}(Object(Illuminate\Http\Request)) > #11 /koel/bootstrap/cache/compiled.php(9585): call_user_func(Object(Closure), Object(Illuminate\Http\Request)) > #12 [internal function]: Illuminate\Pipeline\Pipeline->Illuminate\Pipeline{closure}(Object(Illuminate\Http\Request)) > #13 /koel/bootstrap/cache/compiled.php(9567): call_user_func(Object(Closure), Object(Illuminate\Http\Request)) > #14 /koel/bootstrap/cache/compiled.php(8916): Illuminate\Pipeline\Pipeline->then(Object(Closure)) > #15 /koel/bootstrap/cache/compiled.php(8901): Illuminate\Routing\ControllerDispatcher->callWithinStack(Object(App\Http\Controllers\API\SettingController), Object(Illuminate\Routing\Route), Object(Illuminate\Http\Request), 'save') > #16 /koel/bootstrap/cache/compiled.php(7855): Illuminate\Routing\ControllerDispatcher->dispatch(Object(Illuminate\Routing\Route), Object(Illuminate\Http\Request), 'App\Http\Contro...', 'save') > #17 /koel/bootstrap/cache/compiled.php(7826): Illuminate\Routing\Route->runWithCustomDispatcher(Object(Illuminate\Http\Request)) > #18 /koel/bootstrap/cache/compiled.php(7479): Illuminate\Routing\Route->run(Object(Illuminate\Http\Request)) > #19 [internal function]: Illuminate\Routing\Router->Illuminate\Routing{closure}(Object(Illuminate\Http\Request)) > #20 /koel/bootstrap/cache/compiled.php(9585): call_user_func(Object(Closure), Object(Illuminate\Http\Request)) > #21 /koel/app/Http/Middleware/Authenticate.php(45): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline{closure}(Object(Illuminate\Http\Request)) > #22 [internal function]: App\Http\Middleware\Authenticate->handle(Object(Illuminate\Http\Request), Object(Closure)) > #23 /koel/bootstrap/cache/compiled.php(9577): call_user_func_array(Array, Array) > #24 [internal function]: Illuminate\Pipeline\Pipeline->Illuminate\Pipeline{closure}(Object(Illuminate\Http\Request)) > #25 /koel/bootstrap/cache/compiled.php(9567): call_user_func(Object(Closure), Object(Illuminate\Http\Request)) > #26 /koel/bootstrap/cache/compiled.php(7480): Illuminate\Pipeline\Pipeline->then(Object(Closure)) > #27 /koel/bootstrap/cache/compiled.php(7468): Illuminate\Routing\Router->runRouteWithinStack(Object(Illuminate\Routing\Route), Object(Illuminate\Http\Request)) > #28 /koel/bootstrap/cache/compiled.php(7453): Illuminate\Routing\Router->dispatchToRoute(Object(Illuminate\Http\Request)) > #29 /koel/bootstrap/cache/compiled.php(2302): Illuminate\Routing\Router->dispatch(Object(Illuminate\Http\Request)) > #30 [internal function]: Illuminate\Foundation\Http\Kernel->Illuminate\Foundation\Http{closure}(Object(Illuminate\Http\Request)) > #31 /koel/bootstrap/cache/compiled.php(9585): call_user_func(Object(Closure), Object(Illuminate\Http\Request)) > #32 /koel/bootstrap/cache/compiled.php(2926): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline{closure}(Object(Illuminate\Http\Request)) > #33 [internal function]: Illuminate\Foundation\Http\Middleware\VerifyCsrfToken->handle(Object(Illuminate\Http\Request), Object(Closure)) > #34 /koel/bootstrap/cache/compiled.php(9577): call_user_func_array(Array, Array) > #35 /koel/bootstrap/cache/compiled.php(12949): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline{closure}(Object(Illuminate\Http\Request)) > #36 [internal function]: Illuminate\View\Middleware\ShareErrorsFromSession->handle(Object(Illuminate\Http\Request), Object(Closure)) > #37 /koel/bootstrap/cache/compiled.php(9577): call_user_func_array(Array, Array) > #38 /koel/bootstrap/cache/compiled.php(11536): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline{closure}(Object(Illuminate\Http\Request)) > #39 [internal function]: Illuminate\Session\Middleware\StartSession->handle(Object(Illuminate\Http\Request), Object(Closure)) > #40 /koel/bootstrap/cache/compiled.php(9577): call_user_func_array(Array, Array) > #41 /koel/bootstrap/cache/compiled.php(12686): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline{closure}(Object(Illuminate\Http\Request)) > #42 [internal function]: Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse->handle(Object(Illuminate\Http\Request), Object(Closure)) > #43 /koel/bootstrap/cache/compiled.php(9577): call_user_func_array(Array, Array) > #44 /koel/bootstrap/cache/compiled.php(12623): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline{closure}(Object(Illuminate\Http\Request)) > #45 [internal function]: Illuminate\Cookie\Middleware\EncryptCookies->handle(Object(Illuminate\Http\Request), Object(Closure)) > #46 /koel/bootstrap/cache/compiled.php(9577): call_user_func_array(Array, Array) > #47 /koel/bootstrap/cache/compiled.php(2983): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline{closure}(Object(Illuminate\Http\Request)) > #48 [internal function]: Illuminate\Foundation\Http\Middleware\CheckForMaintenanceMode->handle(Object(Illuminate\Http\Request), Object(Closure)) > #49 /koel/bootstrap/cache/compiled.php(9577): call_user_func_array(Array, Array) > #50 [internal function]: Illuminate\Pipeline\Pipeline->Illuminate\Pipeline{closure}(Object(Illuminate\Http\Request)) > #51 /koel/bootstrap/cache/compiled.php(9567): call_user_func(Object(Closure), Object(Illuminate\Http\Request)) > #52 /koel/bootstrap/cache/compiled.php(2249): Illuminate\Pipeline\Pipeline->then(Object(Closure)) > #53 /koel/bootstrap/cache/compiled.php(2232): Illuminate\Foundation\Http\Kernel->sendRequestThroughRouter(Object(Illuminate\Http\Request)) > #54 /koel/index.php(53): Illuminate\Foundation\Http\Kernel->handle(Object(Illuminate\Http\Request)) > #55 /koel/server.php(19): require_once('/ko...') > #56 {main} > > — > Reply to this email directly or view it on GitHub > https://github.com/phanan/koel/issues/39#issuecomment-165955933.
Author
Owner

@reeslo commented on GitHub (Dec 19, 2015):

'image_mime' => '',
'picturetype' => 'Other',
'description' => '',
'datalength' => 24534,

<!-- gh-comment-id:165960164 --> @reeslo commented on GitHub (Dec 19, 2015): 'image_mime' => '', 'picturetype' => 'Other', 'description' => '', 'datalength' => 24534,
Author
Owner

@reeslo commented on GitHub (Dec 19, 2015):

[2015-12-19 08:18:47] local.ERROR: array (
'data' => '' . "\0" . '' . "\0" . '' . "\0" . '',
'image_mime' => '',
'picturetype' => 'Other',
'description' => '',
'datalength' => 3,
)

<!-- gh-comment-id:165960237 --> @reeslo commented on GitHub (Dec 19, 2015): [2015-12-19 08:18:47] local.ERROR: array ( 'data' => '' . "\0" . '' . "\0" . '' . "\0" . '', 'image_mime' => '', 'picturetype' => 'Other', 'description' => '', 'datalength' => 3, )
Author
Owner

@reeslo commented on GitHub (Dec 19, 2015):

the first contain a big binary data. tell me how can I get the filepath if you want to know what type of file is it.

<!-- gh-comment-id:165960283 --> @reeslo commented on GitHub (Dec 19, 2015): the first contain a big binary data. tell me how can I get the filepath if you want to know what type of file is it.
Author
Owner

@phanan commented on GitHub (Dec 19, 2015):

Try changing this line into:

$fileName = uniqid().'.'.strtolower(isset($extension[1]) ? $extension[1] : 'png');

Basically we're assuming it to be a PNG file here.

<!-- gh-comment-id:165960550 --> @phanan commented on GitHub (Dec 19, 2015): Try changing [this line](https://github.com/phanan/koel/blob/master/app%2FModels%2FAlbum.php#L71) into: ``` php $fileName = uniqid().'.'.strtolower(isset($extension[1]) ? $extension[1] : 'png'); ``` Basically we're assuming it to be a PNG file here.
Author
Owner

@reeslo commented on GitHub (Dec 19, 2015):

It works !

<!-- gh-comment-id:165962527 --> @reeslo commented on GitHub (Dec 19, 2015): It works !
Author
Owner

@phanan commented on GitHub (Dec 19, 2015):

Great. I'll introduce this fix into the codebase. Thanks for reporting!

On Sat, Dec 19, 2015 at 5:08 PM, Reeslo notifications@github.com wrote:

It works !


Reply to this email directly or view it on GitHub
https://github.com/phanan/koel/issues/39#issuecomment-165962527.

<!-- gh-comment-id:165962567 --> @phanan commented on GitHub (Dec 19, 2015): Great. I'll introduce this fix into the codebase. Thanks for reporting! On Sat, Dec 19, 2015 at 5:08 PM, Reeslo notifications@github.com wrote: > It works ! > > — > Reply to this email directly or view it on GitHub > https://github.com/phanan/koel/issues/39#issuecomment-165962527.
Author
Owner

@reeslo commented on GitHub (Dec 19, 2015):

For the first file (wo has empty $extension[1])

For this file seems not an png :
56751e7be6647

<!-- gh-comment-id:165962583 --> @reeslo commented on GitHub (Dec 19, 2015): For the first file (wo has empty $extension[1]) For this file seems not an png : ![56751e7be6647](https://cloud.githubusercontent.com/assets/2724844/11912340/9498338e-a638-11e5-9c28-3c089b4bb349.png)
Author
Owner

@reeslo commented on GitHub (Dec 19, 2015):

I have located the album folder for this corrupted file.

You can see in the complete dump of $info = $this->getID3->analyze($file->getPathname()); (App\Services\Media > getInfo) :

https://framadrop.org/r/PNP2ZY1GNV#Pk+ioG3FTDn2TU8G0sgqGkWgXfhLvKQHxnQD9Vxu+KE=
You can see the file mime is image/jpeg

Screenshot of folder content :
folder

<!-- gh-comment-id:166009630 --> @reeslo commented on GitHub (Dec 19, 2015): I have located the album folder for this corrupted file. You can see in the complete dump of $info = $this->getID3->analyze($file->getPathname()); (App\Services\Media > getInfo) : https://framadrop.org/r/PNP2ZY1GNV#Pk+ioG3FTDn2TU8G0sgqGkWgXfhLvKQHxnQD9Vxu+KE= You can see the file mime is image/jpeg Screenshot of folder content : ![folder](https://cloud.githubusercontent.com/assets/2724844/11914333/148129f8-a67e-11e5-994c-a7984ad5c7d9.png)
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/koel-koel#30
No description provided.