Entendo que precisei remover Content-Disposition: ...
line dos cabeçalhos de resposta. Como foi mais fácil, resolvi o problema editando / hackeando o código PHP da OwnCloud.
No arquivo lib/private/response.php
, mudei a função setContentDispositionHeader
da seguinte forma:
static public function setContentDispositionHeader( $filename, $type = 'attachment' ) {
if (OC_Request::isUserAgent(array(
OC_Request::USER_AGENT_IE,
OC_Request::USER_AGENT_ANDROID_MOBILE_CHROME,
OC_Request::USER_AGENT_FREEBOX
))) {
header( 'Content-Disposition: ' . rawurlencode($type) . '; filename="' . rawurlencode( $filename ) . '"' );
} else {
// cca-hack-id:make-raw-output-property ###
// cca-hack-id:make-raw-output-property ### I needed something like "raw" format of github.com.
// cca-hack-id:make-raw-output-property ###
// cca-hack-id:make-raw-output-property ### Usage with an example:
// cca-hack-id:make-raw-output-property ### 1. share a single file and get a public link (MY_PUBLIC_LINK) for the file.
// cca-hack-id:make-raw-output-property ### 2. get the file's direct url (MY_PUBLIC_LINK&download)
// cca-hack-id:make-raw-output-property ### 3. append '&raw' to the url: MY_PUBLIC_LINK&download&raw
// cca-hack-id:make-raw-output-property ###
// cca-hack-id:make-raw-output-property ### If you want to undo this hack, remove all lines which contains 'cca-hack-id:make-raw-output-property' string.
// cca-hack-id:make-raw-output-property ###
if (!array_key_exists('raw', $_GET)) { // cca-hack-id:make-raw-output-property
header( 'Content-Disposition: ' . rawurlencode($type) . '; filename*=UTF-8\'\'' . rawurlencode( $filename )
. '; filename="' . rawurlencode( $filename ) . '"' );
} // cca-hack-id:make-raw-output-property
}
}