How to display files of s3 bucket in browser by clicking on preview icon?

download_url = BW::Services::S3DebtDocumentGetPresigner.new(
user_id: user_id,
debt_id: debt.id,
file_name: document.title
).url

preview_url = download_url.split(’?’)[0]

This is the code i tried