file-extension

MVC ignoring .jpg file extension on certain route — Use Controller action?

泄露秘密 提交于 2019-12-11 07:43:12
问题 I'm trying to serve image files from a specific url system, like so: mysite/Images/Category/File_Name.extension I've set up a route like so: routes.MapRoute( "ImagesRoute", // Route name "Images/{category}/{file}.jpg", // URL with parameters new { controller = "Posts", action = "ViewImage", category = "", file = "" } // Parameter defaults ); Which is supposed to map to my controller action: public ActionResult ViewImage(string category, string file) { var dir = Server.MapPath("/Images"); var

Get Request fails for .com email addresses because Spring interpretes it as a extensions

旧时模样 提交于 2019-12-10 18:52:09
问题 (See edit part below 20.08.2015) I had a similar problem recently (Get request only works with trailing slash (spring REST annotations)) and the solution was to add a regex to the value of @RequestMapping (see also Spring MVC @PathVariable getting truncated). But now we have realised that the problem still exists, but only for email addresses ending on .com or .org. This is very weird. Shortly, I use Spring Annotations building a REST Service. I have a GET request with three parameters, the

Node js: How to get file signature headers instead of mime-type?

假如想象 提交于 2019-12-10 18:38:22
问题 I downloaded this module for my node js project, and it seems to work fine up to a certain point. If you console.log(mime.lookup(pathToFile)); it returns the correct file type that the file has. The problem is that it checks the file extension to get the file type and not check the first couple of bytes of the file (file signature headers) to actually get the correct file type. So if I have a .png image, it returns image/png but if I just were to change the file extension to something like

What is the '.tt' extension?

时间秒杀一切 提交于 2019-12-10 15:55:30
问题 I work with a bunch of something.js.tt JavaScript files using Knockout and a bunch of something-else.tt HTML files. The infrastructure is mostly a C backend with Perl serving API and we use these .tt files to show the HTML and .js.tt to serve the Knockout.js code. What is .tt ? 回答1: A TT file is a Visual Studio Text Template, developed by Microsoft. 回答2: Text Template Transformation Toolkit, shortly written as T4, uses the .tt file extension for its source files. It is Microsoft's template

UrlRewriteFilter Rule to Remove JSP File Extention

余生颓废 提交于 2019-12-10 12:01:00
问题 I would like to use UrlRewriteFilter to remove JSP file extentions in a generic manner to avoid having to specify individual servlet-mappings for 150+ files. Does anyone know what the rule would be for something like that? From *.jsp to * ie: /Login.jsp would be translated to /Login 回答1: So after much experimentation I found out how to do remove the JSP extension from all pages with urlrewrite. The rule below translates any page that has 1 or more characters in the page URI and forwards it to

How to identify the file type even though the file-extension has been changed?

廉价感情. 提交于 2019-12-10 11:24:36
问题 This question was migrated from Information Security Stack Exchange because it can be answered on Stack Overflow. Migrated 6 years ago . Files are categorized by file-extension. So my question is, how to identify the file type even the file extension has been changed. For example, i have a video file with name myVideo.mp4 , i have changed it to myVideo.txt . So if i double-click it, the preferred text editor will open the file, and won't open the exact content. But, if i play myVideo.txt in a

Register a python script as default for file type

纵然是瞬间 提交于 2019-12-10 11:05:22
问题 I am making an application with python which will need to be associated with a file type. I need a cross platform solution (can be different for different platforms) that includes setting the icon for the file type, having my application open when a file of that type is double-clicked and being able to reference that file when my application is opened. To clarify Lets say that I have an application called FooEdit, that edits .foo files. .foo files have the mime type of text/plain . Here is

Extracting File Extensions from AppleScript Paths

白昼怎懂夜的黑 提交于 2019-12-10 10:59:49
问题 I'm writing an Apple Script that ultimately will mark commercials for all iTunes exports from EyeTV. But I'm running into a simple problem with AppleScript paths, which the EyeTV app returns as recording locations. Here's the context: set recordingID to 370404006 set myid to recordingID as integer tell application "EyeTV" set eyetvr_file to get the location of recording id myid as alias end tell return eyetvr_file alias "Macintosh HD2:Documents:EyeTV Archive:South Park.eyetv:000000001613eaa6

Apache: How to rewrite URL with no file extension and ignore case?

北战南征 提交于 2019-12-10 10:27:50
问题 I'm running Ubuntu 12.04 with Apache 2.2.22 and PHP 5.3.10. I'd like users to be able to request pages on my site without having to type the '.php' extension, and without having to worry about case sensitivity. For example, URLs like these... http://www.site.com/test/phpinfo http://www.site.com/test/PhPiNfO ...should both lead to: http://www.site.com/test/phpinfo.php I started with case insensitivity by following the accepted answer in this question. Here's what my '/etc/apache2/sites

Internet Explorer removes .exe extension from download when followed by URL parameters

怎甘沉沦 提交于 2019-12-10 01:58:48
问题 I am serving files from Amazon S3 now, and I generate a secure URL using the API. Works great everywhere except for people downloading .exe files in IE. I have tested this on IE 8 and 7. If running a local webserver you can test by putting notepad.exe in your web root. Go to http://localhost/notepad.exe (or equivalent) Now try http://localhost/notepad.exe? It should save the file as notepad, without extension. Is this a 'feature' because googling it is coming up with nothing. Thanks to the