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

Paladox created this task.Nov 3 2015, 11:23 PM
Paladox updated the task description. (Show Details)
Paladox raised the priority of this task from to Needs Triage.
Paladox added a project: Phabricator.
Paladox added a subscriber: Paladox.
Restricted Application added subscribers: StudiesWorld, scfc, Aklapper. · View Herald TranscriptNov 3 2015, 11:23 PM
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 updated the task description. (Show Details)Nov 3 2015, 11:30 PM
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.

Aklapper added a comment.EditedNov 3 2015, 11:32 PM

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.

greg added a subscriber: greg.Nov 3 2015, 11:52 PM

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 changed the task status from Stalled to Open.Nov 4 2015, 9:01 AM
Aklapper triaged this task as Lowest priority.
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.

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

greg added a comment.Nov 4 2015, 6:58 PM

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 updated the task description. (Show Details)
greg raised the priority of this task from Lowest to Normal.
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

Dzahn added a subscriber: Dzahn.Nov 10 2015, 9:07 PM

@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 closed this task as Resolved.Nov 10 2015, 10:57 PM
Dzahn claimed this task.
Paladox reopened this task as Open.Nov 12 2015, 5:39 PM

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.

Dzahn added a comment.Dec 12 2015, 1:41 AM

@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

Dzahn added a comment.EditedJan 5 2016, 7:03 PM

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.

mmodell closed this task as Resolved.Apr 16 2016, 2:52 AM