jq emits JSON, so a filter producing a string prints it with surrounding double quotes and with interior characters escaped. Assigning that to a shell variable gives a value that includes the quote characters, which then appear in file paths and URLs. '-r', or '--raw-output', prints strings without quotes; '-j' additionally suppresses the trailing newline, which matters when composing output.
For structured output there are dedicated formats. '@csv' and '@tsv' require an array of scalars and handle quoting and escaping correctly. '@sh' quotes each value for POSIX shell consumption, so 'jq -r "@sh \"rm -- \(.name)\""' produces a command that is safe against spaces and quotes in the value. '@base64' and '@base64d' encode and decode, and '@uri' percent-encodes.
The common failure is looping over 'jq -r ".[].name"' with a bare for loop, which splits on whitespace and breaks on any name containing a space. Emit null-delimited output instead, with '-j' and an explicit '\u0000' separator, and read it with 'while IFS= read -r -d \"\"'.