Code Monkey home page Code Monkey logo

Comments (51)

alonbl avatar alonbl commented on May 18, 2024 9

This is an important feature, to be able to download manually from the site but clicking a link directly into text editor or other program. Going via base64 is good for machine but not usable for people. Can you please reopen?

from gitiles.

johnmellor avatar johnmellor commented on May 18, 2024 8

This would also be useful for linking/viewing excessively large files. For example https://raw.githubusercontent.com/scheib/chromium/master/tools/metrics/histograms/histograms.xml loads instantly as plain text and uses only 134MB of RAM despite being 100,000+ lines, whereas the same file https://chromium.googlesource.com/chromium/src/+/master/tools/metrics/histograms/histograms.xml with syntax highlighting takes 3 minutes to load and uses 1016MB of RAM.

from gitiles.

EvanCarroll avatar EvanCarroll commented on May 18, 2024 3

This is a pain. Especially for projects like this which were previously downloading from src.chromium.org just fine.

from gitiles.

bmaupin avatar bmaupin commented on May 18, 2024 3

Meanwhile this simple one liner can be used to download & decode a file within a Linux shell, e.g.:

curl "https://android.googlesource.com/device/lge/bullhead/+/master/mixer_paths.xml?format=TEXT"| base64 --decode > mixer_paths.xml

Source: #106 (comment)

from gitiles.

concatime avatar concatime commented on May 18, 2024 3

On my system, I didn’t have base64, so I used this:

curl -s 'https://android.googlesource.com/device/lge/bullhead/+/master/mixer_paths.xml?format=TEXT' | python -m base64 -d

It works with both Python 2 and 3 and requires no external modules. But it’s probably slower than base64 for enormous files.

from gitiles.

warren-bank avatar warren-bank commented on May 18, 2024 2

PSA:

This was bothering me too.. so I just now whipped up a little Chromium extension to provide a workaround. The .crx is published under releases.

Disclaimers:

  • I'm not posting the links here for shameless self-promotion
    • I couldn't care less if anyone else uses it or not
  • the extension is not in the Google store, nor will it ever be
    • I refuse to support or participate in walled gardens
    • the fork of Chromium that I use allows side-loading .crx extension
      • if yours doesn't.. that's not my problem

Enjoy :)

from gitiles.

spearce avatar spearce commented on May 18, 2024 1
So does that mean this isn't going to be fixed?

base64 decoding is not a solution.

A normal person should be able to go to 

https://chromium.googlesource.com/chromium/src/+/master/tools/bisect-builds.py

And simply click a link to download the file.

Reported by None on 2014-10-10 05:38:15

from gitiles.

zmodem avatar zmodem commented on May 18, 2024 1

Any update on this?

For files inside Chromium it's tempting to work around this by getting raw files through a GitHub mirror (https://github.com/chromium/chromium which I have no idea how much to trust) but that seems like a pretty weird work-around.

from gitiles.

warren-bank avatar warren-bank commented on May 18, 2024 1

minor update:

in the spirit of releasing a version that everyone can use, and since it would take minimal effort to repackage the userscript in the .crx into a standalone greasemonkey script that can be run in most browsers (ex: compatible with tampermonkey in Chrome).. I added a branch to do just that. The download/update URL for this greasemonkey script is here.

from gitiles.

alonbl avatar alonbl commented on May 18, 2024 1

from gitiles.

spearce avatar spearce commented on May 18, 2024
Support downloading the contents of a single file "as is" from Gitiles, for example:

 https://android.googlesource.com/platform/manifest/+raw/master/default.xml

to get the raw XML rather than it wrapped inside of HTML.

This is a bit of a challenge because the server has cookies, and this is possibly unsafe
user supplied data. Raw HTML or JavaScript could cause the user's session to be able
to be hijacked.

Reported by None on 2012-11-11 15:30:45

from gitiles.

spearce avatar spearce commented on May 18, 2024
Would providing a json format (issue 27) have less security concerns?  Chrome team has
tools which need to get current state of certain files.  This is currently done via
chromium svn servers but I'd like to transition these tools to use GoB.  An example
file which tools fetch is:  https://chromium.googlesource.com/chromium/src/+/master/DEPS

Reported by None on 2013-05-05 18:10:31

from gitiles.

spearce avatar spearce commented on May 18, 2024
Would it be sufficient to always set the content-type to something like "application/octet-stream"?
Are there any browsers that would attempt to parse/display that, rather than just downloading?
That might help avoid the browser hijacking issue, while still allowing easy programmatic
access from our tools.

Reported by None on 2013-05-06 09:14:52

from gitiles.

spearce avatar spearce commented on May 18, 2024
Or another option, maybe always put the file(s) into a zip archive, which would force
downloading and unzipping, again avoiding browser handling of the content, but still
being pretty easy for scripts to deal with.

Reported by None on 2013-05-06 09:18:51

from gitiles.

spearce avatar spearce commented on May 18, 2024
#1: JSON is a good idea, that would be easy to implement in the short term. Works for
the scripting case but we still want true raw file support for e.g. viewing in-repo
HTML.

#2: Unfortunately if you include a file with an <img> or <script> tag browsers are
still liable to do content sniffing regardless of Content-Type in the header :(. Modern
browsers will respect Content-Disposition: Attachment but older IEs may not. And again
we still want to support browsing raw HTML stored in the repo.

#3: Zip archive is another idea, but between that and JSON I think I prefer JSON :)

Reported by None on 2013-05-06 14:30:53

from gitiles.

spearce avatar spearce commented on May 18, 2024
Also an issue for Google's "Skia" open-source project.  Details are at https://code.google.com/p/skia/issues/detail?id=1898
('git transition blocker: skia_tools.js needs to download tip-of-tree global_variables.json')

Reported by None on 2013-12-13 12:43:51

from gitiles.

spearce avatar spearce commented on May 18, 2024
GitHub has this functionality (they serve raw blobs as text/plain). Are they just unaware
or unconcerned about the content-sniffing issue alluded to in #2?

Reported by None on 2014-01-07 17:41:51

from gitiles.

spearce avatar spearce commented on May 18, 2024
github solves the problem of cookies by serving the raw URL from a different hostname;
i.e. https://github.com/dataarts/tailbone/blob/master/Guardfile is served raw from
https://raw.github.com/dataarts/tailbone/master/Guardfile

Could that work for gitiles?

Reported by None on 2014-02-06 15:42:00

from gitiles.

spearce avatar spearce commented on May 18, 2024
Yes, for googlesource.com we plan to use a new, cookieless domain (and for open-source
Gitiles the domain will simply be configurable and we trust administrators to understand
the risks and implement their own cookie policy).

This quarter I plan to do JSON support and at least get the ball rolling with our security/domain
teams on the cookieless domain part.

Reported by None on 2014-02-06 15:47:58

from gitiles.

spearce avatar spearce commented on May 18, 2024
Blocking:
https://code.google.com/p/chromium/issues/detail?id=337030
https://code.google.com/p/chromium/issues/detail?id=345087
and some aspects of:
https://code.google.com/p/chromium/issues/detail?id=343251

Reported by None on 2014-03-10 09:44:14

from gitiles.

spearce avatar spearce commented on May 18, 2024
Base64-encoded raw file support is checked in as:
https://gerrit-review.googlesource.com/55202

Example URL (won't work until this is released for googlesource.com):
https://gerrit.googlesource.com/gitiles/+/master/gitiles-servlet/src/main/java/com/google/gitiles/PathServlet.java?format=TEXT

Reported by None on 2014-03-14 21:28:22

from gitiles.

spearce avatar spearce commented on May 18, 2024

Reported by None on 2014-04-24 16:33:44

from gitiles.

spearce avatar spearce commented on May 18, 2024

Reported by None on 2014-04-25 09:17:59

from gitiles.

spearce avatar spearce commented on May 18, 2024
FWIW, the base64-encoded delivery is fine for my Chromium use cases. If you want to
leave this open pending "true" raw file support, that's fine, but I don't think it
should be a priority.

Reported by None on 2014-04-25 09:22:49

from gitiles.

spearce avatar spearce commented on May 18, 2024
From the Skia perspective, base64 and JSON cover all of our bases too.

Reported by None on 2014-04-25 09:49:16

from gitiles.

spearce avatar spearce commented on May 18, 2024
Blocking crbug.com/369329

Reported by None on 2014-05-15 12:10:50

from gitiles.

spearce avatar spearce commented on May 18, 2024
sebmarchand, that crbug appears to be about a Python script. Any reason base64 doesn't
work for you?

Reported by None on 2014-05-15 12:22:50

from gitiles.

spearce avatar spearce commented on May 18, 2024
Yeah, I updated that bug with some notes on how to fetch. I don't think this is blocking.

Reported by None on 2014-05-15 12:37:15

from gitiles.

spearce avatar spearce commented on May 18, 2024
Another issue is with pointing bug reporters and others to download bisect-builds.py
from the Chromium repo. We used to link to the file on src.chromium.org. This page
seems to now point to the gitiles page:
http://www.chromium.org/developers/bisect-builds-py

But that's not especially useful as there's no clear way to download it. For this use,
I think we'd have to be able to download the file itself, and not some encoded version.

Reported by None on 2014-09-04 07:55:06

from gitiles.

spearce avatar spearce commented on May 18, 2024
I was able to download bisect-builds.py by adding ?format=TEXT on the end, then manually
base64 decoding it, but it was a bit of a pain...

Reported by None on 2014-09-14 18:35:27

from gitiles.

spearce avatar spearce commented on May 18, 2024
This is a real PITA!! Why on earth google doesn't provide a "raw" code link?? Absolutely
absurd. Please fix!

Reported by None on 2014-10-18 19:11:18

from gitiles.

spearce avatar spearce commented on May 18, 2024
please increase the priority of this - it's a real pain to have to attach bisect-builds.py
to tickets when I want people to help me bisect Chromium.  Asking them to base64 decode
a raw download is too much of a barrier to entry.

Reported by None on 2015-01-30 13:53:19

from gitiles.

spearce avatar spearce commented on May 18, 2024
wfh, the way to bump priority is to raise this with your local chrome-infra team member
and they can work it into feature planning with our team.

As for bisect-builds.py, I'm not yet convinced base64 decoding is too much of a barrier
to entry.

The documentation page linked above says, paraphrasing:
1. Download bisect-builds.py from this link.
2. Run this python command.

Would the barrier to entry really be that much higher if the documentation were rewritten
to say:
1. Run this command to download bisect-builds.py:
$ curl 'https://chromium.googlesource.com/chromium/src/+/master/tools/bisect-builds.py'
| base64 -d > bisect-builds.py
2. Run this python command

?

Reported by None on 2015-01-30 14:00:26

from gitiles.

spearce avatar spearce commented on May 18, 2024
d:\src>curl
'curl' is not recognized as an internal or external command,
operable program or batch file.

d:\src>base64
'base64' is not recognized as an internal or external command,
operable program or batch file.

So I think it does for some less technical users (that would be typical of bisect-builds
users -- if they were devs they'd already have the tree pulled and just use it from
there.)

Reported by None on 2015-01-30 14:08:02

from gitiles.

spearce avatar spearce commented on May 18, 2024
Ah. Windows. Point taken.

Reported by None on 2015-01-30 14:19:30

from gitiles.

spearce avatar spearce commented on May 18, 2024
In addition to bisect-builds.py, when reporting compiler regressions I used to say "1.
Download file <link> 2. Build it with these flags". This is no longer possible either.
(Again, Windows.)

Reported by None on 2015-04-29 13:24:23

from gitiles.

spearce avatar spearce commented on May 18, 2024
Issue 83 has been merged into this issue.

Reported by None on 2015-08-24 06:04:12

from gitiles.

jrn avatar jrn commented on May 18, 2024

https://gerrit-review.googlesource.com/c/gitiles/+/78140 implements this but as noted at https://gerrit-review.googlesource.com/c/gitiles/+/78140#message-0046d3acb866847091e3f43d1827ea39ed0ea703 it needs some work.

from gitiles.

DarrienG avatar DarrienG commented on May 18, 2024

Who thought this was a good idea yet? Why has this not been implemented or getting any attention? The previous review has been in review since February.

Just because it's in review doesn't mean the issue should be closed. It still is not implemented.

from gitiles.

jrn avatar jrn commented on May 18, 2024

puzzled Are you saying the issue is closed?

from gitiles.

DarrienG avatar DarrienG commented on May 18, 2024

It was late an I misinterpreted the above closed as this issue being closed. With that said - it isn't like this issue hasn't actually been closed before.

from gitiles.

TWiStErRob avatar TWiStErRob commented on May 18, 2024

For example: I want to be download these JAR/AAR files without having to go through a full git clone or any kind of decoding:
https://chromium.googlesource.com/android_tools/+/master/sdk/extras/android/m2repository/com/android/support/test/rules/0.5

from gitiles.

nico avatar nico commented on May 18, 2024

The workarounds are nice, but don't work in all contexts, e.g. src indexing in a pdb ideally exposes just an http(s) URL. This issue means we can't use that (see also https://bugs.chromium.org/p/chromium/issues/detail?id=956004#c3).

This would be useful for Chromium.

from gitiles.

hanwen avatar hanwen commented on May 18, 2024

Hi, Nico. Can you work with ajp to prioritize this request with Chromium? We can certainly do this, but it is a significant work to setup a separate domain to host this content.

from gitiles.

keitalbame avatar keitalbame commented on May 18, 2024

Just got bitten by this while using Gerrit documentation instructions not referring to this.

from gitiles.

shelper avatar shelper commented on May 18, 2024

I was able to download from browser and then decode to the original file, but not through curl,
My gitiles is hosted on a gerrit server that requires authentication

I tried the curl -u usernae:http_credential URL but seems not working... any suggestion?

Meanwhile this simple one liner can be used to download & decode a file within a Linux shell, e.g.:

curl "https://android.googlesource.com/device/lge/bullhead/+/master/mixer_paths.xml?format=TEXT"| base64 --decode > mixer_paths.xml

Source: #106 (comment)

from gitiles.

xobotyi avatar xobotyi commented on May 18, 2024

+1 here because id like to have the possibility to provide permalink to the most actual version of JSON schema for in-house tool. Workarounds are not the solution at all, since JSON schema is specified as field of the document.
Something like ?format=RAW would be great.

from gitiles.

sto6 avatar sto6 commented on May 18, 2024

Any hope for .md files? curl with ?format=TEXT method fails for .md files with: The specified format type is not supported

INVALID_ARGUMENT: Request contains an invalid argument
[type.googleapis.com/google.rpc.LocalizedMessage]
locale: "en-US"
message: "The specified format type is not supported"

from gitiles.

ilmari-lauhakangas avatar ilmari-lauhakangas commented on May 18, 2024

Thanks for the tip! I created a PowerShell + .NET equivalent for LibreOffice dev setup instructions

$Request = Invoke-WebRequest -Uri https://git.libreoffice.org/lode/+/refs/heads/master/bin/install_cygwin.ps1?format=TEXT; [Text.Encoding]::Utf8.GetString([Convert]::FromBase64String($Request.Content))

from gitiles.

thiagowfx avatar thiagowfx commented on May 18, 2024

Pingback (internal): https://yaqs.corp.google.com/eng/q/6755054194404622336

from gitiles.

thiagowfx avatar thiagowfx commented on May 18, 2024

Another workaround other than curl | base64 (h/t to @mathiasbynens), run the following snippet in Chrom{e,ium} DevTools:

const url = document.querySelector('.Footer a[href*="?format=TEXT"]').href;
const response = await fetch(url);
const contents = await response.text();
const dataUrl = `data:text/plain;base64,${contents}`;
const anchor = document.createElement('a');
anchor.href = dataUrl;
anchor.download = true;
anchor.textContent = 'download file';
document.body.append(anchor);

...which uses fetch to get the Base64-encoded content, creates a data: URL, and then inserts an <a href="…" download> element into the page.

from gitiles.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.