##// END OF EJS Templates
hgweb: Pass only filename instead of full path when downloading raw files....
Thomas Arendsen Hein -
r6136:acfb9fa4 default
parent child Browse files
Show More
@@ -85,8 +85,8 b' class wsgirequest(object):'
85 if type is not None:
85 if type is not None:
86 headers.append(('Content-Type', type))
86 headers.append(('Content-Type', type))
87 if filename:
87 if filename:
88 headers.append(('Content-Disposition', 'inline; filename=%s' %
88 headers.append(('Content-Disposition',
89 filename))
89 'inline; filename=%s' % filename.split('/')[-1]))
90 if length:
90 if length:
91 headers.append(('Content-Length', str(length)))
91 headers.append(('Content-Length', str(length)))
92 self.header(headers)
92 self.header(headers)
@@ -2,17 +2,18 b''
2
2
3 hg init test
3 hg init test
4 cd test
4 cd test
5 cat >sometext.txt <<ENDSOME
5 mkdir sub
6 cat >sub/sometext.txt <<ENDSOME
6 This is just some random text
7 This is just some random text
7 that will go inside the file and take a few lines.
8 that will go inside the file and take a few lines.
8 It is very boring to read, but computers don't
9 It is very boring to read, but computers don't
9 care about things like that.
10 care about things like that.
10 ENDSOME
11 ENDSOME
11 hg add sometext.txt
12 hg add sub/sometext.txt
12 hg commit -d "1 0" -m "Just some text"
13 hg commit -d "1 0" -m "Just some text"
13 hg serve -p $HGPORT -A access.log -E error.log -d --pid-file=hg.pid
14 hg serve -p $HGPORT -A access.log -E error.log -d --pid-file=hg.pid
14 cat hg.pid >> $DAEMON_PIDS
15 cat hg.pid >> $DAEMON_PIDS
15 ("$TESTDIR/get-with-headers.py" localhost:$HGPORT '/?f=f165dc289438;file=sometext.txt;style=raw' content-type content-length content-disposition) >getoutput.txt &
16 ("$TESTDIR/get-with-headers.py" localhost:$HGPORT '/?f=37afcac6d393;file=sub/sometext.txt;style=raw' content-type content-length content-disposition) >getoutput.txt &
16
17
17 sleep 5
18 sleep 5
18 kill `cat hg.pid`
19 kill `cat hg.pid`
@@ -7,4 +7,4 b' This is just some random text'
7 that will go inside the file and take a few lines.
7 that will go inside the file and take a few lines.
8 It is very boring to read, but computers don't
8 It is very boring to read, but computers don't
9 care about things like that.
9 care about things like that.
10 host - - [date] "GET /?f=f165dc289438;file=sometext.txt;style=raw HTTP/1.1" 200 -
10 host - - [date] "GET /?f=37afcac6d393;file=sub/sometext.txt;style=raw HTTP/1.1" 200 -
General Comments 0
You need to be logged in to leave comments. Login now