Page MenuHomePhabricator

Diffusion support for viewing the raw file in the browser
Closed, ResolvedPublic

Description

Steps to reproduce

Actual results

  • When you click on view raw it wants you to download file.

Expected results

  • The raw text file would show up in the browser.

Upstream task: https://secure.phabricator.com/T8170

Event Timeline

Paladox raised the priority of this task from to Needs Triage.
Paladox updated the task description. (Show Details)
Paladox added a project: Phabricator.
Paladox subscribed.
Aklapper changed the task status from Open to Stalled.Nov 3 2015, 11:25 PM

Cannot reproduce in Firefox 41 with the given steps.

Paladox set Security to None.

If you go to https://phabricator.wikimedia.org/F2912532 it wont allow you to view plain text it wants you to download the whole file.

How is your last comment about some random file attachment uploaded by some user in Phabricator related to the task description which is about browsing and viewing code files in a Diffusion repository?

Because it is about viewing raw files. I gave the link to a file that shows you have to download the raw file, you carn't view the raw file in plain text.

How is your last comment about some random file attachment uploaded by some user in Phabricator related to the task description which is about browsing and viewing code files in a Diffusion repository?

@Aklapper, because it is an example file from a repo. Please AGF. Go to any file listed on https://phabricator.wikimedia.org/diffusion/ETRA/, eg https://phabricator.wikimedia.org/diffusion/ETRA/browse/master/MessageChecks.php then click on "view raw" which takes you to https://phabricator.wikimedia.org/F2912605

Ah interesting.
So for example this does not happen with https://phabricator.wikimedia.org/diffusion/ETRA/browse/master/.jshintrc - I just tried the "wrong" files so far to reproduce.

@Paladox: That's why clear exact steps to reproduce are welcome, and not "Click on any file." as long as you have not tried all files...

Aklapper renamed this task from Allow us to view raw files in phabricator sames file formats as git.wikimedia.org to Allow viewing raw text files in Phabricator within browser.Nov 4 2015, 9:01 AM
Aklapper changed the task status from Stalled to Open.
Aklapper triaged this task as Lowest priority.

Oh sorry I thought that because one file was doing it that all files would.

Oh sorry I thought that because one file was doing it that all files would.

For future reference please don't assume anything but provide absolutely clear and specific steps to reproduce. Thanks.

According to https://secure.phabricator.com/T8170 a workaround is to add the support to files.viewable-mime-types

So, I think the main issue here is related to Diffusion repo browsing, which is reasonable. I'm going to retitle/focus this for just that (which is then our tracking task for that upstream one Paladox just linked).

greg renamed this task from Allow viewing raw text files in Phabricator within browser to Diffusion support for viewing the raw file in the browser.Nov 4 2015, 7:00 PM
greg raised the priority of this task from Lowest to Medium.
greg updated the task description. (Show Details)
greg edited projects, added Diffusion; removed Phabricator.

The patch I uploaded is temp as the upstream task describes to use it as a workaround. This task shoulden be closed when patch is merged. Since theres other files that are supported in raw format in gitblit but not yet here.

Change 251034 had a related patch set uploaded (by Paladox):
Allow viewing php files in raw format in browsers

https://gerrit.wikimedia.org/r/251034

Change 251034 merged by Dzahn:
Allow viewing php files in raw format in browsers

https://gerrit.wikimedia.org/r/251034

@Paladox the change has been merged and applied on iridium. but i can't really confirm it as fixed yet, i still just get a download button. can you try?

@Dzahn it works on an iPhone 6 Plus haven't tested on a laptop but I presume it works if it doesn't do download on a iPhone. But you have to now click download which will show the content in browser instead of downloading it. I think once you press that raw button it should go to the raw file not make you go to the page where you have to click download too to view the file .

@Paladox ok, thanks for the clarification. i noticed the same (first goes to an extra page, then download button) but wasn't sure. afaict this is the best we can get right now.

Dzahn claimed this task.

Re opening since I tested on laptop and still asks you to download you carn't view it in browser.

We have applied the fix suggested by upstream but the bug has been reopened as not working.

Dzahn removed Dzahn as the assignee of this task.Nov 20 2015, 12:53 AM

it seems that 'text/x-php': 'text/x-php; charset=utf-8' doesn't work for desktops but works for mobiles.

Would setting it like 'text/x-php': 'text/plain; charset=utf-8' or not. How can we get it to work on desktop like it is on mobile.

@Paladox So it's still not working since your latest change got merged today?:(

Yes and I doint know why. It works on mobile but not on desktop.

Hi I did the steps are in description.

I can try to describe the problem from my view (I can replicate it):
For example:

  1. Go to a repo (I choosed https://phabricator.wikimedia.org/diffusion/ETRA/)
  2. Go to a .php file (I choosed https://phabricator.wikimedia.org/diffusion/ETRA/browse/master/TranslateTasks.php)
  3. Click on "view raw"
  4. Normaly you should see the raw file no, but you are here: https://phabricator.wikimedia.org/F3204274 and you only can download the file, but you don't have chance to view raw.

I hope this helps

Yes, i can confirm that. Clicking "view raw file" in diffusion does not actually show the raw file but takes you the the "F" phabricator page for it.

In even less words, this link says "view=raw":

https://phabricator.wikimedia.org/diffusion/ETRA/browse/master/TranslateTasks.php?view=raw

but redirects to https://phabricator.wikimedia.org/F3204274

I uploaded a patch that was merged and I tested it on my local install and worked but didn't on diffusion wikimedia. I think this may be a bug because if you use custom domains for files then it causes the problem but if you doint use a custom domain then you can view the file in browser.

Adding @mmodell since this seems to be a bug since it also happends upstream but that's probably because they haven't set it to what we set it. But you can view some files like .gitreview as raw files but php you carn't but what's strange is you can view it on your mobile browser ie iPhone safari but not on a Windows 10 PC. So looks like a bug.

6b9b0cc5b26a fixes this, at least in Firefox, however, it is not yet deployed to wmf/stable.