Pendant light cord too long
This installation needs a junction box. Electrical ordinances require that all power connections be made inside an accessible protective box. 

In the USA your governing code will be your state's adoption or enhancement of some edition of the NEC. Other places in the civilized world will have similar ordinances. This is why I asked where you are. 

If you are handy with detail carpentry, you may be able to do this job yourself, but if you are not confident and comfortable, you should hire a handyman or even an electrician. Ask for someone who can do "old work" "wiring repair".