You were likely linking an item that had a space in it, when testing with Kanegasi's code.
strsplit accepts an optional 3rd argument that defines how many pieces to make.
https://wow.gamepedia.com/API_strsplit
You can still use Kanegasi's simpler method like this.
Lua Code:
local command, link = strsplit(" ", input, 2)